mirror of
https://github.com/PrivateBin/PrivateBin.git
synced 2025-08-24 05:59:23 -04:00
XSS flaw correction
With a client IE < 10 there was a XSS security flaw. Other browsers were not affected. Also corrected spacing display with IE<10. (cherry picked from commit 28813cd82ae47e556b610da3c7302a6709e27431) Conflicts: CHANGELOG.md index.php js/zerobin.js lib/vizhash16x16.php
This commit is contained in:
parent
d9930978ba
commit
bc8b23d35e
16 changed files with 23 additions and 17 deletions
|
@ -6,7 +6,7 @@
|
|||
* @link http://sebsauvage.net/wiki/doku.php?id=php:zerobin
|
||||
* @copyright 2012 Sébastien SAUVAGE (sebsauvage.net)
|
||||
* @license http://www.opensource.org/licenses/zlib-license.php The zlib/libpng License
|
||||
* @version 0.18
|
||||
* @version 0.19
|
||||
*/
|
||||
|
||||
// Immediately start random number generator collector.
|
||||
|
@ -152,6 +152,9 @@ function pasteID() {
|
|||
return window.location.search.substring(1);
|
||||
}
|
||||
|
||||
function htmlEntities(str) {
|
||||
return String(str).replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>').replace(/"/g, '"');
|
||||
}
|
||||
/**
|
||||
* Set text of a DOM element (required for IE)
|
||||
* This is equivalent to element.text(text)
|
||||
|
@ -162,8 +165,8 @@ function setElementText(element, text) {
|
|||
// For IE<10.
|
||||
if ($('div#oldienotice').is(":visible")) {
|
||||
// IE<10 does not support white-space:pre-wrap; so we have to do this BIG UGLY STINKING THING.
|
||||
element.text(text.replace(/\n/ig,'{BIG_UGLY_STINKING_THING__OH_GOD_I_HATE_IE}'));
|
||||
element.html(element.text().replace(/{BIG_UGLY_STINKING_THING__OH_GOD_I_HATE_IE}/ig,"\n<br />"));
|
||||
var html = htmlEntities(text).replace(/\n/ig,"\r\n<br>");
|
||||
element.html('<pre>'+html+'</pre>');
|
||||
}
|
||||
// for other (sane) browsers:
|
||||
else {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue