[systemd-commits] src/journal

Lennart Poettering lennart at kemper.freedesktop.org
Wed Oct 10 14:01:14 PDT 2012


 src/journal/browse.html |    6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

New commits:
commit 522795e07742b4e804896147a21e026bb34602ba
Author: Mantas MikulÄ—nas <grawity at gmail.com>
Date:   Wed Oct 10 23:00:25 2012 +0200

    journal: properly escape HTML entities in browse.html

diff --git a/src/journal/browse.html b/src/journal/browse.html
index 068b296..362611b 100644
--- a/src/journal/browse.html
+++ b/src/journal/browse.html
@@ -177,6 +177,10 @@
                                 return u.toString() + " B";
                 }
 
+                function escapeHTML(s) {
+                        return s.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">");
+                }
+
                 function machineOnResult(event) {
                         if ((event.currentTarget.readyState != 4) ||
                                 (event.currentTarget.status != 200 && event.currentTarget.status != 0))
@@ -310,7 +314,7 @@
                                 else if (d.MESSAGE instanceof Array)
                                         buf += "[" + formatBytes(d.MESSAGE.length) + " blob data]";
                                 else
-                                        buf += d.MESSAGE;
+                                        buf += escapeHTML(d.MESSAGE);
 
                                 buf += '</a></td></tr>';
                         }



More information about the systemd-commits mailing list