Browse Source

refine error detector

dev
破娃酱 8 years ago
parent
commit
3b0200581c
  1. 7
      shadowsocks/obfsplugin/obfs_tls.py

7
shadowsocks/obfsplugin/obfs_tls.py

@ -241,12 +241,13 @@ class tls_ticket_auth(plain.plain):
if not match_begin(buf, b'\x16\x03\x01'): if not match_begin(buf, b'\x16\x03\x01'):
return self.decode_error_return(ogn_buf) return self.decode_error_return(ogn_buf)
buf = buf[3:] buf = buf[3:]
if struct.unpack('>H', buf[:2])[0] > len(buf) - 2: header_len = struct.unpack('>H', buf[:2])[0]
if header_len > len(buf) - 2:
return (b'', False, False) return (b'', False, False)
self.recv_buffer = self.recv_buffer[struct.unpack('>H', buf[:2])[0] + 5:] self.recv_buffer = self.recv_buffer[header_len + 5:]
self.handshake_status = 2 self.handshake_status = 2
buf = buf[2:] buf = buf[2:header_len + 2]
if not match_begin(buf, b'\x01\x00'): #client hello if not match_begin(buf, b'\x01\x00'): #client hello
logging.info("tls_auth not client hello message") logging.info("tls_auth not client hello message")
return self.decode_error_return(ogn_buf) return self.decode_error_return(ogn_buf)

Loading…
Cancel
Save