From fd309c365005d1dfee102fea1accb36c29788a0b Mon Sep 17 00:00:00 2001
From: Aleksander Machniak <alec@alec.pl>
Date: Mon, 14 Apr 2014 09:07:47 -0400
Subject: [PATCH] Fix XSS issue in plain text spellchecker (#1489806)

---
 program/js/googiespell.js |    9 +++++----
 1 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/program/js/googiespell.js b/program/js/googiespell.js
index 9832116..c33c568 100644
--- a/program/js/googiespell.js
+++ b/program/js/googiespell.js
@@ -524,7 +524,7 @@
             $(dummy).html(suggestions[i]);
 
             $(item).mouseover(this.item_onmouseover).mouseout(this.item_onmouseout)
-        	    .click(function(e) { ref.correctError(id, elm, e.target.firstChild) });
+              .click(function(e) { ref.correctError(id, elm, e.target.firstChild) });
 
             item.appendChild(dummy);
             row.appendChild(item);
@@ -565,14 +565,15 @@
                     ref.saveOldValue(elm, elm.innerHTML);
 
                 ref.updateOrginalText(offset, elm.innerHTML, edit_input.value, id);
-                $(elm).attr('is_corrected', true).css('color', 'green').html(edit_input.value);
+                $(elm).attr('is_corrected', true).css('color', 'green').text(edit_input.value);
                 ref.hideErrorWindow();
             }
             return false;
         };
 
-        $(edit_input).width(120).css({'margin': 0, 'padding': 0});
-        $(edit_input).val(elm.innerHTML).attr('googie_action_btn', '1');
+        $(edit_input).width(120)
+          .css({'margin': 0, 'padding': 0})
+          .val($(elm).text()).attr('googie_action_btn', '1');
         $(edit).css('cursor', 'default').attr('googie_action_btn', '1');
 
         $(ok_pic).attr('src', this.img_dir + 'ok.gif')

--
Gitblit v1.9.1