pystun
pystun copied to clipboard
Logic error in handling error response
in the logic of stun_test, there's code as below around line
# around line 113:
recvCorr = False
while not recvCorr:
# around line 136,
bind_resp_msg = dictValToMsgType[msgtype] == "BindResponseMsg"
tranid_match = tranid.upper() == binascii.b2a_hex(buf[4:20]).upper()
if bind_resp_msg and tranid_match:
It does not handle the logic which the stun server return BindErrorResponseMsg, which lead to infinite loop.
This can be reproduce with a self setup stun server, and run the function with source ip = '0.0.0.0'.
But it's not a very big problem, I suggest to throw an error in this situation. Because the server did response, but just it's an error response.
Thanks.
@Feng-Zihao Thanks for reporting. Which stun server are you using to test locally - stuntman?
Oh... First reply from github issues !! I'm using this one, on linux. http://www.stunprotocol.org/