]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
Account for possible NULL pointer when we receive a 408 in response to a REGISTER
authorMark Michelson <mmichelson@digium.com>
Fri, 16 Jan 2009 22:42:13 +0000 (22:42 +0000)
committerMark Michelson <mmichelson@digium.com>
Fri, 16 Jan 2009 22:42:13 +0000 (22:42 +0000)
It may be that by the time we receive a reply to a REGISTER request, the attempt has
timed out and thus the registry structure pointed to by the corresponding sip_pvt has
gone away. This situation was handled properly for a 200 OK response, but the 408
case assumed that the sip_registry struct was non-NULL, thus potentially causing a crash

This commit fixes this assumption and prints out a message to the console if we should
receive a late 408 response to a REGISTER

(closes issue #14211)
Reported by: aborghi
Patches:
      14211.diff uploaded by putnopvut (license 60)
Tested by: aborghi

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@168975 65c4cc65-6c06-0410-ace0-fbb531ad65f3

channels/chan_sip.c

index 004aaaabec744156b994f53839019c44c1e52f93..cc8fafed81d4a3e00b0e2597351c34a123f89bd9 100644 (file)
@@ -12698,7 +12698,11 @@ static int handle_response_register(struct sip_pvt *p, int resp, char *rest, str
                break;
        case 408:       /* Request timeout */
                /* Got a timeout response, so reset the counter of failed responses */
-               r->regattempts = 0;
+               if (r) {
+                       r->regattempts = 0;
+               } else {
+                       ast_log(LOG_WARNING, "Got a 408 response to our REGISTER on call %s after we had destroyed the registry object\n", p->callid);
+               }
                break;
        case 479:       /* SER: Not able to process the URI - address is wrong in register*/
                ast_log(LOG_WARNING, "Got error 479 on register to %s@%s, giving up (check config)\n", p->registry->username,p->registry->hostname);