1
0
mirror of https://github.com/chylex/Nextcloud-Desktop.git synced 2025-05-15 14:34:09 +02:00
Nextcloud-Desktop/admin/qt/patches/0003-Fix-crash-if-PAC-script-retrieval-returns-a-null-CFD.patch
2015-11-16 18:35:50 +01:00

40 lines
1.8 KiB
Diff

From 83bd9393e5564ea9168fda90c0f44456633a483a Mon Sep 17 00:00:00 2001
From: Daniel Molkentin <daniel@molkentin.de>
Date: Mon, 5 Jan 2015 15:22:57 +0100
Subject: [PATCH 3/3] 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>
---
src/network/kernel/qnetworkproxy_mac.cpp | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/src/network/kernel/qnetworkproxy_mac.cpp b/src/network/kernel/qnetworkproxy_mac.cpp
index 6be032e..a1ac349 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.
--
1.8.3.4 (Apple Git-47)