Merged revisions 201380 via svnmerge from
authorDavid Brooks <dbrooks@digium.com>
Wed, 17 Jun 2009 19:15:07 +0000 (19:15 +0000)
committerDavid Brooks <dbrooks@digium.com>
Wed, 17 Jun 2009 19:15:07 +0000 (19:15 +0000)
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r201380 | dbrooks | 2009-06-17 13:45:50 -0500 (Wed, 17 Jun 2009) | 9 lines

  Checks for NULL sip_pvt pointer in chan_sip.c->acf_channel_read()

  Zombie channels could be passed, and chan_sip.c wasn't checking for it.
  Could crash Asterisk. Now checking for NULL pointer.

  (closes issue #15330)
  Reported by: okrief
  Tested by: dbrooks
........

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

channels/chan_sip.c

index 9e3e238..144b6fa 100644 (file)
@@ -21046,6 +21046,10 @@ static int acf_channel_read(struct ast_channel *chan, const char *funcname, char
 
        memset(buf, 0, buflen);
 
+       if (p == NULL) {
+               return -1;
+       }
+
        if (!strcasecmp(args.param, "peerip")) {
                ast_copy_string(buf, p->sa.sin_addr.s_addr ? ast_inet_ntoa(p->sa.sin_addr) : "", buflen);
        } else if (!strcasecmp(args.param, "recvip")) {