pystun icon indicating copy to clipboard operation
pystun copied to clipboard

Logic error in handling error response

Open Feng-Zihao opened this issue 11 years ago • 2 comments

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 avatar Jul 21 '14 04:07 Feng-Zihao

@Feng-Zihao Thanks for reporting. Which stun server are you using to test locally - stuntman?

jtriley avatar Nov 05 '14 21:11 jtriley

Oh... First reply from github issues !! I'm using this one, on linux. http://www.stunprotocol.org/

Feng-Zihao avatar Nov 07 '14 02:11 Feng-Zihao