summaryrefslogtreecommitdiffstats
path: root/src/network/access
diff options
context:
space:
mode:
authorShane Kearns <shane.kearns@accenture.com>2011-12-09 11:49:50 +0000
committerQt by Nokia <qt-info@nokia.com>2011-12-12 13:34:11 +0100
commitb830c9cededf995fab1b0919a81658ceaec8d422 (patch)
treee229323c82caa1501b7186629b773224521bc03f /src/network/access
parentd6fb4463b815a0fa21b6f087dc17ca3a45ee56e7 (diff)
Fix null pointer dereference in NTLM authentication
If NTLM authentication is required for the URL with an empty path, then QNetworkAuthenticationCache::findClosestMatch(url.path()) returns 0. e.g. "http://10.1.2.3". Return a default constructed credential in this case. Change-Id: I84ad3b308ee3f74fbbac9ad0f11dbdc66047b50b Reviewed-by: Robin Burchell <robin+qt@viroteck.net> Reviewed-by: Martin Petersson <Martin.Petersson@nokia.com>
Diffstat (limited to 'src/network/access')
-rw-r--r--src/network/access/qnetworkaccessauthenticationmanager.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/network/access/qnetworkaccessauthenticationmanager.cpp b/src/network/access/qnetworkaccessauthenticationmanager.cpp
index 1b15cf9cdf..b618ccc945 100644
--- a/src/network/access/qnetworkaccessauthenticationmanager.cpp
+++ b/src/network/access/qnetworkaccessauthenticationmanager.cpp
@@ -283,9 +283,12 @@ QNetworkAccessAuthenticationManager::fetchCachedCredentials(const QUrl &url,
QNetworkAuthenticationCache *auth =
static_cast<QNetworkAuthenticationCache *>(authenticationCache.requestEntryNow(cacheKey));
- QNetworkAuthenticationCredential cred = *auth->findClosestMatch(url.path());
+ QNetworkAuthenticationCredential *cred = auth->findClosestMatch(url.path());
+ QNetworkAuthenticationCredential ret;
+ if (cred)
+ ret = *cred;
authenticationCache.releaseEntry(cacheKey);
- return cred;
+ return ret;
}
void QNetworkAccessAuthenticationManager::clearCache()