]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Bug #2365: cachemgr.cgi fails to HTML encode config dumps properly
authorHenrik Nordstrom <henrik@henriknordstrom.net>
Tue, 24 Jun 2008 22:39:16 +0000 (00:39 +0200)
committerHenrik Nordstrom <henrik@henriknordstrom.net>
Tue, 24 Jun 2008 22:39:16 +0000 (00:39 +0200)
log_format and a couple other directives may contain HTML reserved characters
such as < >, and these needs to be HTML quoted in the output.

tools/cachemgr.cc

index 38393912161a52b5baacb98b5881d06c8d8c4077..54ee12cf4eb9a36d68f95f288dbb2fbef764046b 100644 (file)
@@ -417,7 +417,7 @@ error_html(const char *msg)
     printf("<HTML><HEAD><TITLE>Cache Manager Error</TITLE>\n");
     printf("<STYLE type=\"text/css\"><!--BODY{background-color:#ffffff;font-family:verdana,sans-serif}--></STYLE></HEAD>\n");
     printf("<BODY><H1>Cache Manager Error</H1>\n");
-    printf("<P>\n%s</P>\n", msg);
+    printf("<P>\n%s</P>\n", html_quote(msg));
     print_trailer();
 }
 
@@ -531,7 +531,7 @@ munge_other_line(const char *buf, cachemgr_request * req)
     if (!strchr(buf, '\t') || *buf == '\t') {
         /* nope, just text */
         snprintf(html, sizeof(html), "%s%s",
-                 table_line_num ? "</table>\n<pre>" : "", buf);
+                 table_line_num ? "</table>\n<pre>" : "", html_quote(buf));
         table_line_num = 0;
         return html;
     }
@@ -568,7 +568,7 @@ munge_other_line(const char *buf, cachemgr_request * req)
         l += snprintf(html + l, sizeof(html) - l, "<%s colspan=\"%d\" align=\"%s\">%s</%s>",
                       ttag, column_span,
                       is_header ? "center" : is_number(cell) ? "right" : "left",
-                      cell, ttag);
+                      html_quote(cell), ttag);
     }
 
     xfree(buf_copy);