From 445a79c32c2b03217a7b697117f8d85a084aa532 Mon Sep 17 00:00:00 2001 From: "bienvenu%nventure.com" Date: Mon, 20 Nov 2006 17:28:11 +0000 Subject: [PATCH] fix crash during import of outlook (and other e-mail sources) messages with lines longer than 990 chars, and sending of messages with lines longer than that, sr=mscott 182231 git-svn-id: svn://10.0.0.236/trunk@215470 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/mailnews/compose/src/nsMsgSend.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/mozilla/mailnews/compose/src/nsMsgSend.cpp b/mozilla/mailnews/compose/src/nsMsgSend.cpp index c85bc3b53c3..c9057beb102 100644 --- a/mozilla/mailnews/compose/src/nsMsgSend.cpp +++ b/mozilla/mailnews/compose/src/nsMsgSend.cpp @@ -1878,7 +1878,7 @@ nsMsgComposeAndSend::EnsureLineBreaks(const char *body, PRUint32 bodyLen) // in the worse case, the body will be solid, no linebreaks. // that will require us to insert a line break every LINE_BREAK_MAX bytes PRUint32 worstCaseLen = bodyLen+((bodyLen/LINE_BREAK_MAX)*NS_LINEBREAK_LEN)+1; - newBody = (char *) PR_Malloc(worstCaseLen); + newBody = (char *) PR_Calloc(1, worstCaseLen); if (!newBody) return NS_ERROR_OUT_OF_MEMORY; newBodyPos = newBody; } @@ -1900,8 +1900,8 @@ nsMsgComposeAndSend::EnsureLineBreaks(const char *body, PRUint32 bodyLen) // if newBody is non-null is non-zero, we inserted a linebreak if (newBody) { - // don't forget about part after the last linebreak we inserted - PL_strcpy(newBodyPos, body+lastPos); + // don't forget about part after the last linebreak we inserted + PL_strncpy(newBodyPos, body+lastPos, bodyLen - lastPos); m_attachment1_body = newBody; m_attachment1_body_length = PL_strlen(newBody); // not worstCaseLen