[Pkg-privacy-commits] [obfsproxy] 278/353: Cast bytearray to str before calling struct.unpack() in socks5.py.
Ximin Luo
infinity0 at moszumanska.debian.org
Sat Aug 22 13:02:11 UTC 2015
This is an automated email from the git hooks/post-receive script.
infinity0 pushed a commit to branch master
in repository obfsproxy.
commit d50446b22dea5bd48c27fa989fb4cedd5fcd2c3d
Author: Yawning Angel <yawning at schwanenlied.me>
Date: Thu Mar 27 02:43:07 2014 +0000
Cast bytearray to str before calling struct.unpack() in socks5.py.
This works around <http://bugs.python.org/issue10212> which prevented
the SOCKS5 server from working for clients running Python < 2.7.4,
fixing <https://bugs.torproject.org/11329>.
---
ChangeLog | 5 +++++
obfsproxy/network/socks5.py | 10 ++++++----
2 files changed, 11 insertions(+), 4 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 0ef5910..391f9cf 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+Changes in version 0.2.8 - UNRELEASED:
+ - Fix a bug in the SOCKS5 sever code. An exception would be raised on systems
+ with Python < 2.7.4. Patch by Yawning Angel. Fixes #11329.
+
+
Changes in version 0.2.7 - 2014-03-15
- Support SOCKS5 instead of SOCKS4. Patch by Yawning Angel. Fixes #9221.
- Fix a scramblesuit bug that makes bridges reject a session
diff --git a/obfsproxy/network/socks5.py b/obfsproxy/network/socks5.py
index 3959ad1..8463628 100644
--- a/obfsproxy/network/socks5.py
+++ b/obfsproxy/network/socks5.py
@@ -499,10 +499,11 @@ class _ByteBuffer(bytearray):
ntohs (bool): Convert from network byte order?
"""
+ foo = str(self[0:2])
if ntohs:
- ret = struct.unpack("!H", self[0:2])[0]
+ ret = struct.unpack("!H", foo)[0]
else:
- ret = struct.unpack("H", self[0:2])[0]
+ ret = struct.unpack("H", foo)[0]
del self[0:2]
return ret
@@ -530,10 +531,11 @@ class _ByteBuffer(bytearray):
ntohl (bool): Convert from network byte order?
"""
+ foo = str(self[0:4])
if ntohl:
- ret = struct.unpack("!I", self[0:4])[0]
+ ret = struct.unpack("!I", foo)[0]
else:
- ret = struct.unpack("I", self[0:4])[0]
+ ret = struct.unpack("I", foo)[0]
del self[0:4]
return ret
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-privacy/packages/obfsproxy.git
More information about the Pkg-privacy-commits
mailing list