From 4fc23312286860c9309d1a3a0cf9e9fa4612bd81 Mon Sep 17 00:00:00 2001 From: "norris%netscape.com" Date: Thu, 1 Oct 1998 00:23:05 +0000 Subject: [PATCH] Fix bug 326297: various security holes caused by lack of quoting around displayed URLs. git-svn-id: svn://10.0.0.236/trunk@11623 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/include/net.h | 6 +++++ mozilla/lib/layout/layinfo.c | 13 +++++++---- mozilla/lib/libmisc/glhist.c | 13 ++++++----- mozilla/modules/libimg/src/ilclient.cpp | 12 +++++----- mozilla/network/cache/mkcache.c | 8 ++++--- mozilla/network/cache/mkmemcac.c | 8 ++++--- mozilla/network/main/mkutils.c | 28 ++++++++++++++++++++++++ mozilla/network/protocol/about/mkabout.c | 9 ++++++-- 8 files changed, 74 insertions(+), 23 deletions(-) diff --git a/mozilla/include/net.h b/mozilla/include/net.h index 1d6f5cba7ea..068c7b8bb09 100644 --- a/mozilla/include/net.h +++ b/mozilla/include/net.h @@ -1912,6 +1912,12 @@ extern char* NET_ScanHTMLForURLs(const char* input); extern char * NET_EscapeHTML(const char * string); +/* escapes doubles quotes in a url, to protect + * the html page embedding the url. + */ +extern char * NET_EscapeDoubleQuote(const char * string); + + /* register a newsrc file mapping */ extern Bool NET_RegisterNewsrcFile(char *filename, diff --git a/mozilla/lib/layout/layinfo.c b/mozilla/lib/layout/layinfo.c index d0d910d1dfb..cfca95cb1c1 100644 --- a/mozilla/lib/layout/layinfo.c +++ b/mozilla/lib/layout/layinfo.c @@ -451,6 +451,7 @@ LO_DocumentInfo(MWContext *context, NET_StreamClass *stream) char *backdrop_image_url; char *url; char *base_url; + char *escaped; lo_FormData *form_list; if (context == NULL) @@ -488,12 +489,16 @@ LO_DocumentInfo(MWContext *context, NET_StreamClass *stream) char buf[1024]; url = XP_STRDUP(top_state->url); - XP_STRCPY(buf, ""); + escaped = NET_EscapeDoubleQuote(url); + STREAM_WRITE(escaped); + PR_Free(escaped); + XP_STRCPY(buf,"\">"); STREAM_WRITE(buf); - STREAM_WRITE(url); + escaped = NET_EscapeHTML(url); + STREAM_WRITE(escaped); + PR_Free(escaped); XP_STRCPY(buf,"