]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
If the sip private structure is null, sip_setoption() will defref the null pointer...
authorMark Murawki <markm@intellasoft.net>
Mon, 18 Jul 2011 12:35:57 +0000 (12:35 +0000)
committerMark Murawki <markm@intellasoft.net>
Mon, 18 Jul 2011 12:35:57 +0000 (12:35 +0000)
Ideally, sip_setoption shouldn't be called if there is a lack of a sip private structure.  But this will fix a crash.

(closes issue ASTERISK-17909)
Reported by: Mark Murawski
Tested by: Mark Murawski

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

channels/chan_sip.c

index 3c0a46e2d3eeacbb39e22d853d353a76c10d370e..6ebb1b2ec95c85f9fc9aba2a00b710f29297f56e 100644 (file)
@@ -4231,6 +4231,11 @@ static int sip_setoption(struct ast_channel *chan, int option, void *data, int d
        int res = -1;
        struct sip_pvt *p = chan->tech_pvt;
 
+        if (!p) {
+               ast_log(LOG_ERROR, "Attempt to Ref a null pointer.  sip private structure is gone!\n");
+               return -1;
+        }
+
        sip_pvt_lock(p);
 
        switch (option) {