[tbb-commits] [tor-browser/tor-browser-45.4.0esr-6.5-1] Bug 20304: SOCKS socket does not support spaces and other special characters

gk at torproject.org gk at torproject.org
Mon Oct 17 07:03:25 UTC 2016


commit 48a73d262e04c2a90cf660445568cbcf01e83b9c
Author: Kathy Brade <brade at pearlcrescent.com>
Date:   Thu Oct 6 14:09:04 2016 -0400

    Bug 20304: SOCKS socket does not support spaces and other special characters
    
    Correctly decode file URL paths before using for them in
    Unix domain socket paths.
    
    The upstream bug is https://bugzilla.mozilla.org/show_bug.cgi?id=1308275.
---
 netwerk/socket/nsSOCKSIOLayer.cpp | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/netwerk/socket/nsSOCKSIOLayer.cpp b/netwerk/socket/nsSOCKSIOLayer.cpp
index b26408d..be69725 100644
--- a/netwerk/socket/nsSOCKSIOLayer.cpp
+++ b/netwerk/socket/nsSOCKSIOLayer.cpp
@@ -20,6 +20,8 @@
 #include "nsICancelable.h"
 #include "nsThreadUtils.h"
 #include "nsIURL.h"
+#include "nsIFile.h"
+#include "nsNetUtil.h"
 #include "mozilla/Logging.h"
 #include "mozilla/net/DNS.h"
 #include "mozilla/unused.h"
@@ -133,17 +135,15 @@ private:
         nsresult rv;
         MOZ_ASSERT(aProxyAddr);
 
-        nsCOMPtr<nsIURL> url = do_CreateInstance(NS_STANDARDURL_CONTRACTID, &rv);
+        nsCOMPtr<nsIFile> socketFile;
+        rv = NS_GetFileFromURLSpec(aDomainSocketPath,
+                                   getter_AddRefs(socketFile));
         if (NS_WARN_IF(NS_FAILED(rv))) {
             return rv;
         }
 
-        if (NS_WARN_IF(NS_FAILED(rv = url->SetSpec(aDomainSocketPath)))) {
-            return rv;
-        }
-
         nsAutoCString path;
-        if (NS_WARN_IF(NS_FAILED(rv = url->GetPath(path)))) {
+        if (NS_WARN_IF(NS_FAILED(rv = socketFile->GetNativePath(path)))) {
             return rv;
         }
 



More information about the tbb-commits mailing list