Skip to content

Commit

Permalink
Sanitize font names and families
Browse files Browse the repository at this point in the history
  • Loading branch information
LukasReschke committed Dec 1, 2014
1 parent 88f4abb commit 6d363da
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions programs/editor/widgets/fontPicker.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,10 @@
*/
/*global define,require,document */
define("webodf/editor/widgets/fontPicker", [
"dijit/form/Select"],
"dijit/form/Select",
"dojox/html/entities"],

function (Select) {
function (Select, HtmlEntities) {
"use strict";

/**
Expand Down Expand Up @@ -91,7 +92,7 @@ define("webodf/editor/widgets/fontPicker", [
name = documentFonts[i].name;
family = documentFonts[i].family || name;
selectionList.push({
label: '<span style="font-family: ' + family + ';">' + name + '</span>',
label: '<span style="font-family: ' + HtmlEntities.encode(family) + ';">' + HtmlEntities.encode(name)+ '</span>',
value: name
});
}
Expand All @@ -104,7 +105,7 @@ define("webodf/editor/widgets/fontPicker", [
// Lastly populate the fonts provided by the editor
for (i = 0; i < editorFonts.length; i += 1) {
selectionList.push({
label: '<span style="font-family: ' + editorFonts[i] + ';">' + editorFonts[i] + '</span>',
label: '<span style="font-family: ' + HtmlEntities.encode(editorFonts[i]) + ';">' + HtmlEntities.encode(editorFonts[i]) + '</span>',
value: editorFonts[i]
});
}
Expand Down

0 comments on commit 6d363da

Please sign in to comment.