From fa9ca98c398438edfd77b876f9e4b666cac4fdf9 Mon Sep 17 00:00:00 2001 From: "Matt A. Tobin" Date: Sun, 10 Nov 2019 22:54:16 -0500 Subject: Bug 1401858 - add null check to avoid crash in EncodedHeader()/DecodedHeader(). Tag #1273 --- mailnews/mime/src/MimeHeaderParser.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'mailnews/mime') diff --git a/mailnews/mime/src/MimeHeaderParser.cpp b/mailnews/mime/src/MimeHeaderParser.cpp index 18d81023e..4fd7bc982 100644 --- a/mailnews/mime/src/MimeHeaderParser.cpp +++ b/mailnews/mime/src/MimeHeaderParser.cpp @@ -10,7 +10,6 @@ #include "nsMemory.h" #include "nsAutoPtr.h" #include "nsCOMPtr.h" -#include "nsIMimeConverter.h" #include "nsIMsgHeaderParser.h" namespace mozilla { @@ -76,6 +75,7 @@ nsCOMArray DecodedHeader(const nsAString &aHeader) return retval; } nsCOMPtr headerParser(services::GetHeaderParser()); + NS_ENSURE_TRUE(headerParser, retval); msgIAddressObject **addresses = nullptr; uint32_t length; nsresult rv = headerParser->ParseDecodedHeader(aHeader, false, @@ -95,6 +95,7 @@ nsCOMArray EncodedHeader(const nsACString &aHeader, return retval; } nsCOMPtr headerParser(services::GetHeaderParser()); + NS_ENSURE_TRUE(headerParser, retval); msgIAddressObject **addresses = nullptr; uint32_t length; nsresult rv = headerParser->ParseEncodedHeader(aHeader, aCharset, -- cgit v1.2.3