summaryrefslogtreecommitdiffstats
path: root/src/network
diff options
context:
space:
mode:
authorDaniel Molkentin <daniel@molkentin.de>2015-01-05 15:22:57 +0100
committerDaniel Molkentin <daniel@molkentin.de>2015-01-07 10:29:13 +0100
commit83bd9393e5564ea9168fda90c0f44456633a483a (patch)
treef638faaf71921eff66a4857da6e5f68a4429b14c /src/network
parenta83e4d1d9dd90d4563ce60f27dfb7802a780e33e (diff)
Fix crash if PAC script retrieval returns a null CFData instance
The documentation for CFURLCreateDataAndPropertiesFromResource() does not make this clear but from looking at the CFNetwork implementation and a user stacktrace it appears that this function can return true but not set the data argument under certain circumstances. Change-Id: I48034a640d6f47a51cd5883bbafacad4bcbd0415 Task-number: QTBUG-36787 Patch-By: Robert Knight Reviewed-by: Markus Goetz <markus@woboq.com> Reviewed-by: Peter Hartmann <phartmann@blackberry.com>
Diffstat (limited to 'src/network')
-rw-r--r--src/network/kernel/qnetworkproxy_mac.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/network/kernel/qnetworkproxy_mac.cpp b/src/network/kernel/qnetworkproxy_mac.cpp
index 6be032ed9b..a1ac349949 100644
--- a/src/network/kernel/qnetworkproxy_mac.cpp
+++ b/src/network/kernel/qnetworkproxy_mac.cpp
@@ -240,7 +240,10 @@ QList<QNetworkProxy> macQueryInternal(const QNetworkProxyQuery &query)
qWarning("Unable to get the PAC script at \"%s\" (%s)", qPrintable(pacLocation), cfurlErrorDescription(errorCode));
return result;
}
-
+ if (!pacData) {
+ qWarning("\"%s\" returned an empty PAC script", qPrintable(QCFString::toQString(cfPacLocation)));
+ return result;
+ }
QCFType<CFStringRef> pacScript = CFStringCreateFromExternalRepresentation(kCFAllocatorDefault, pacData, kCFStringEncodingISOLatin1);
if (!pacScript) {
// This should never happen, but the documentation says it may return NULL if there was a problem creating the object.