From f9fe1c4033139d89aa84f9c7b4a0451388c67d3a Mon Sep 17 00:00:00 2001 From: "rhp%netscape.com" Date: Fri, 11 Feb 2000 01:32:20 +0000 Subject: [PATCH] Fix to escape quotes along with the other special characters - Bug #: 27039 - r: bienvenu --- xpcom/io/nsEscape.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/xpcom/io/nsEscape.cpp b/xpcom/io/nsEscape.cpp index 85249f8c6d0..5a8788118a2 100644 --- a/xpcom/io/nsEscape.cpp +++ b/xpcom/io/nsEscape.cpp @@ -174,7 +174,7 @@ NS_COM PRInt32 nsUnescapeCount(char * str) NS_COM char * nsEscapeHTML(const char * string) { - char *rv = (char *) nsAllocator::Alloc(nsCRT::strlen(string)*5 + 1); /* The +1 is for the trailing null! */ + char *rv = (char *) nsAllocator::Alloc(nsCRT::strlen(string)*6 + 1); /* The +1 is for the trailing null! */ char *ptr = rv; if(rv) @@ -203,6 +203,15 @@ nsEscapeHTML(const char * string) *ptr++ = 'p'; *ptr++ = ';'; } + else if (*string == '"') + { + *ptr++ = '&'; + *ptr++ = 'q'; + *ptr++ = 'u'; + *ptr++ = 'o'; + *ptr++ = 't'; + *ptr++ = ';'; + } else { *ptr++ = *string;