]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Bug 1273245 - [SECURITY] Backport upstream bug 1253263 to bmo/4.2 to fix XSS vulnerab...
authorDavid Lawrence <dkl@mozilla.com>
Mon, 16 May 2016 21:17:24 +0000 (21:17 +0000)
committerDavid Lawrence <dkl@mozilla.com>
Mon, 16 May 2016 21:17:31 +0000 (21:17 +0000)
showdependencygraph.cgi

index 24f3b846949d757294ba31c313411fd9932fcceb..5dc3928ed5494d7ef043d441d87eac26dbc808ae 100755 (executable)
@@ -68,13 +68,19 @@ sub CreateImagemap {
             $default = qq{<area alt="" shape="default" href="$1">\n};
         }
 
-        if ($line =~ /^rectangle \((.*),(.*)\) \((.*),(.*)\) (http[^ ]*) (\d+)(\\n.*)?$/) {
+        if ($line =~ /^rectangle \((\d+),(\d+)\) \((\d+),(\d+)\) (http[^ ]*) (\d+)(?:\\n.*)?$/) {
             my ($leftx, $rightx, $topy, $bottomy, $url, $bugid) = ($1, $3, $2, $4, $5, $6);
 
             # Pick up bugid from the mapdata label field. Getting the title from
             # bugtitle hash instead of mapdata allows us to get the summary even
             # when showsummary is off, and also gives us status and resolution.
+            # This text is safe; it has already been escaped.
             my $bugtitle = $bugtitles{$bugid};
+
+            # The URL is supposed to be safe, because it's built manually.
+            # But in case someone manages to inject code, it's safer to escape it.
+            $url = html_quote($url);
+
             $map .= qq{<area alt="bug $bugid" name="bug$bugid" shape="rect" } .
                     qq{title="$bugtitle" href="$url" } .
                     qq{coords="$leftx,$topy,$rightx,$bottomy">\n};