Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

app restarts when processing invalid sip message #112

Open
davehorton opened this issue Sep 14, 2021 · 0 comments
Open

app restarts when processing invalid sip message #112

davehorton opened this issue Sep 14, 2021 · 0 comments
Assignees
Labels

Comments

@davehorton
Copy link
Collaborator

This message caused the app to restart

2021-09-14 16:35:56.407594 recv 572 bytes from tls/[52.229.57.255]:63534 at 16:35:56.407532:
REGISTER sips:54.74.169.84;transport=Tls SIP/2.0^M
To: <sip:[email protected]>^M
From: <sip:[email protected]>;tag=b9035e162^M
Via: SIP/2.0/TLS 10.1.0.4:63534;branch=z9hG4bK-d87543-213921418-1--d87543-;rport^M
Call-ID: b60d05581c3fd47d2^M
CSeq: 2 REGISTER^M
Contact: <sip:[email protected]:63534;transport=TLS>^M
Expires: 3600^M
Max-Forwards: 70^M
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, NOTIFY, MESSAGE, SUBSCRIBE, INFO^M
User-Agent: Voip^M
Digest username="90",realm="",nonce="",uri="sip:54.74.169.84",response="cc9f1ccfba8b0d18a227a92cc4034ae7",algorithm=MD5^M
Content-Length: 0^M

The line starting with Digest is not a valid sip header.

The constructor in the last line below can throw an error, which should be handled

    const obj = this.mapServer.get(socket) ;
    const pos = msg.indexOf(CR) ;
    const leader = -1 === pos ? msg : msg.slice(0, pos) ;
    const token = leader.split('|') ;
    let res, sr, rawMsg ;

    switch (token[1]) {
      case 'sip':
        if (!obj) {
          debug('socket not found, message discarding');
          return ;
        }
        rawMsg = msg.slice(pos + 2) ;
        const sipMsg = new SipMessage(rawMsg) ;
@davehorton davehorton added the bug label Sep 14, 2021
@davehorton davehorton self-assigned this Sep 14, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant