Bug 1492472 - add error checking to avoid crash in nsNNTPProtocol::LoadUrlInternal. r=jorgk
authorMagnus Melin <mkmelin+mozilla@iki.fi>
Fri, 28 Sep 2018 14:26:16 +0300
changeset 33257 ea04f95d5ceb814eeb22e47d72b5e3fa5418ce46
parent 33256 42792e593b1acf771d6a8ef560663d6a60162d3d
child 33258 2727ba9a62aa40c4eef3eea56ea8ca21b7555900
push id387
push userclokep@gmail.com
push dateMon, 10 Dec 2018 21:30:47 +0000
reviewersjorgk
bugs1492472
Bug 1492472 - add error checking to avoid crash in nsNNTPProtocol::LoadUrlInternal. r=jorgk
mailnews/news/src/nsNNTPProtocol.cpp
--- a/mailnews/news/src/nsNNTPProtocol.cpp
+++ b/mailnews/news/src/nsNNTPProtocol.cpp
@@ -1136,22 +1136,25 @@ nsNNTPProtocol::OnProxyAvailable(nsICanc
   return rv;
 }
 
 nsresult
 nsNNTPProtocol::LoadUrlInternal(nsIProxyInfo* aProxyInfo)
 {
   m_proxyRequest = nullptr;
 
-  nsCOMPtr<nsIMsgIncomingServer> server = do_QueryInterface(m_nntpServer);
+  nsresult rv;
+  nsCOMPtr<nsIMsgIncomingServer> server = do_QueryInterface(m_nntpServer, &rv);
+  NS_ENSURE_SUCCESS(rv, rv);
+
   nsCString hostName;
   int32_t port = 0;
   int32_t socketType;
 
-  nsresult rv = server->GetRealHostName(hostName);
+  rv = server->GetRealHostName(hostName);
   NS_ENSURE_SUCCESS(rv, rv);
 
   rv = m_url->GetPort(&port);
   NS_ENSURE_SUCCESS(rv, rv);
 
   rv = server->GetSocketType(&socketType);
   NS_ENSURE_SUCCESS(rv, rv);