]> jfr.im git - irc/kvirc/KVIrc.git/commitdiff
KviHttpRequest: Fix potential null pointer dereference
authorIceN9ne <redacted>
Tue, 4 Sep 2018 19:07:34 +0000 (15:07 -0400)
committerIceN9ne <redacted>
Tue, 4 Sep 2018 19:07:34 +0000 (15:07 -0400)
src/kvilib/net/KviHttpRequest.cpp

index af2ebf4f39c1edf745f16d16adebeb4494c522f0..0114373992bfc9d0a6381397ebfde6a240261dcb 100644 (file)
@@ -718,9 +718,8 @@ bool KviHttpRequest::processHeader(KviCString & szHeader)
                                        }
 
                                        KviCString * headerLocation = hdr.find("Location");
-                                       QString location(headerLocation->ptr());
 
-                                       if(location.isEmpty())
+                                       if(!headerLocation || headerLocation->isEmpty())
                                        {
                                                resetInternalStatus();
                                                m_szLastError = __tr2qs("Bad redirect");
@@ -729,6 +728,7 @@ bool KviHttpRequest::processHeader(KviCString & szHeader)
                                        }
 
                                        KviUrl url;
+                                       QString location(headerLocation->ptr());
 
                                        if(location.startsWith('/'))
                                        {