From 896cc0d1eb3bbd6a3e62eba28169a0b38bf8b08e Mon Sep 17 00:00:00 2001 From: "timeless%mozdev.org" Date: Thu, 2 Jan 2003 17:07:34 +0000 Subject: [PATCH] Bug 187441 URLs not HTML encoded in output --- webtools/web-sniffer/cgiview.c | 11 ++++++++--- webtools/web-sniffer/html.c | 3 +++ 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/webtools/web-sniffer/cgiview.c b/webtools/web-sniffer/cgiview.c index 47234499d5c5..8783354126cb 100644 --- a/webtools/web-sniffer/cgiview.c +++ b/webtools/web-sniffer/cgiview.c @@ -80,14 +80,16 @@ reportHTMLAttributeValue(void *a, HTML *html, Input *input) { URL *url; View *view; + char *urlstring; view = a; if (html->currentAttributeIsURL) { url = urlRelative(html->base, html->currentAttribute->value); - fprintf(view->out, "", me, - url ? (char*) url->url : ""); + urlstring = escapeHTML(url ? (char*) url->url : ""); + fprintf(view->out, "", me, urlstring); + free(urlstring); urlFree(url); } viewHTMLAttributeValue(view, input); @@ -151,12 +153,15 @@ void reportHTTPHeaderValue(void *a, Input *input, unsigned char *url) { View *view; + char *urlstring; view = a; if (url) { - fprintf(view->out, "", me, url); + urlstring = escapeHTML(url); + fprintf(view->out, "", me, urlstring); + free(urlstring); } viewHTTPHeaderValue(view, input); if (url) diff --git a/webtools/web-sniffer/html.c b/webtools/web-sniffer/html.c index b67c4efdbe0c..32d0316711c0 100644 --- a/webtools/web-sniffer/html.c +++ b/webtools/web-sniffer/html.c @@ -899,6 +899,9 @@ escapeHTML(unsigned char *str) case '&': replacement = "&"; break; + case '"': + replacement = """; + break; default: replacement = buf; buf[0] = str[j];