From: Amos Jeffries Date: Fri, 27 Jun 2008 13:11:51 +0000 (-0600) Subject: Author: Henrik Nordstrom X-Git-Tag: SQUID_3_0_STABLE8~34 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1c5f2289c7593c42b111050a1a1e04df96e9a51d;p=thirdparty%2Fsquid.git Author: Henrik Nordstrom Bug #2365: cachemgr.cgi fails to HTML encode config dumps properly log_format and a couple other directives may contain HTML reserved characters such as < >, and these needs to be HTML quoted in the output. --- diff --git a/tools/cachemgr.cc b/tools/cachemgr.cc index 277524d061..7d57333d6b 100644 --- a/tools/cachemgr.cc +++ b/tools/cachemgr.cc @@ -420,7 +420,7 @@ error_html(const char *msg) printf("Cache Manager Error\n"); printf("\n"); printf("

Cache Manager Error

\n"); - printf("

\n%s

\n", msg); + printf("

\n%s

\n", html_quote(msg)); print_trailer(); } @@ -536,7 +536,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 ? "\n
" : "", buf);
+                 table_line_num ? "\n
" : "", html_quote(buf));
         table_line_num = 0;
         return html;
     }
@@ -573,7 +573,7 @@ munge_other_line(const char *buf, cachemgr_request * req)
         l += snprintf(html + l, sizeof(html) - l, "<%s colspan=\"%d\" align=\"%s\">%s",
                       ttag, column_span,
                       is_header ? "center" : is_number(cell) ? "right" : "left",
-                      cell, ttag);
+                      html_quote(cell), ttag);
     }
 
     xfree(buf_copy);