From ea4dcc5931d455e4ee3e958ffa54a9f54ab022c8 Mon Sep 17 00:00:00 2001 From: Daniel Molkentin Date: Mon, 5 Jan 2015 10:45:25 +0100 Subject: [PATCH 1/3] Fix crash on Mac OS if PAC URL contains non-URL legal chars macQueryInternal() was retrieving the PAC URL string as-entered by the user in the 'Proxies' tab of the system network settings dialog and passing it to CFURLCreateWithString(). CFURLCreateWithString() returns null if the input string contains non-URL legal chars or is empty. Change-Id: I9166d0433a62c7b2274b5435a7dea0a16997d10e Patch-By: Robert Knight Task-number: QTBUG-36787 Reviewed-by: Peter Hartmann Reviewed-by: Markus Goetz --- src/network/kernel/qnetworkproxy_mac.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/network/kernel/qnetworkproxy_mac.cpp b/src/network/kernel/qnetworkproxy_mac.cpp index 7d26246..81bce0c 100644 --- a/src/network/kernel/qnetworkproxy_mac.cpp +++ b/src/network/kernel/qnetworkproxy_mac.cpp @@ -221,7 +221,11 @@ QList macQueryInternal(const QNetworkProxyQuery &query) int enabled; if (CFNumberGetValue(pacEnabled, kCFNumberIntType, &enabled) && enabled) { // PAC is enabled - CFStringRef cfPacLocation = (CFStringRef)CFDictionaryGetValue(dict, kSCPropNetProxiesProxyAutoConfigURLString); + // kSCPropNetProxiesProxyAutoConfigURLString returns the URL string + // as entered in the system proxy configuration dialog + CFStringRef pacLocationSetting = (CFStringRef)CFDictionaryGetValue(dict, kSCPropNetProxiesProxyAutoConfigURLString); + QCFType cfPacLocation = CFURLCreateStringByAddingPercentEscapes(kCFAllocatorDefault, pacLocationSetting, NULL, NULL, + kCFStringEncodingUTF8); if (QSysInfo::MacintoshVersion >= QSysInfo::MV_10_5) { QCFType pacData; -- 1.8.3.4 (Apple Git-47)