Bug 1444389 - Fix crash in nsImapProtocol::HandleMessageDownLoadLine(). r=jorgk
authorMagnus Melin <mkmelin+mozilla@iki.fi>
Mon, 01 Oct 2018 15:06:55 +0300
changeset 33327 d3a3e12d2654959356b71569177b6ede3790fd9e
parent 33326 cf7feed01d0db5a8d0705eb6dbee7c54fe119e63
child 33328 d1c3b7b0b9c209a5e6af479ae616aeb8cbb28f5e
push id387
push userclokep@gmail.com
push dateMon, 10 Dec 2018 21:30:47 +0000
reviewersjorgk
bugs1444389
Bug 1444389 - Fix crash in nsImapProtocol::HandleMessageDownLoadLine(). r=jorgk
mailnews/imap/src/nsImapProtocol.cpp
--- a/mailnews/imap/src/nsImapProtocol.cpp
+++ b/mailnews/imap/src/nsImapProtocol.cpp
@@ -3833,16 +3833,17 @@ nsImapProtocol::PostLineDownLoadEvent(co
 // * A line may be passed by parts, e.g., "part1 part2\r\n" may be passed as
 //     HandleMessageDownLoadLine("part 1 ", 1);
 //     HandleMessageDownLoadLine("part 2\r\n", 0);
 //   However, it is assumed that a CRLF or a CRCRLF is never split (i.e., this is
 //   ensured *before* invoking this method).
 void nsImapProtocol::HandleMessageDownLoadLine(const char *line, bool isPartialLine,
                                                char *lineCopy)
 {
+  NS_ENSURE_TRUE_VOID(line);
   NS_ASSERTION(lineCopy == nullptr || !PL_strcmp(line, lineCopy),
                "line and lineCopy must contain the same string");
   const char *messageLine = line;
   uint32_t lineLength = strlen(messageLine);
   const char *cEndOfLine = messageLine + lineLength;
   char *localMessageLine = nullptr;
 
   // If we obtain a partial line (due to fetching by chunks), we do not