Merged revisions 280879 via svnmerge from
authorTilghman Lesher <tilghman@meg.abyt.es>
Wed, 4 Aug 2010 14:05:11 +0000 (14:05 +0000)
committerTilghman Lesher <tilghman@meg.abyt.es>
Wed, 4 Aug 2010 14:05:11 +0000 (14:05 +0000)
https://origsvn.digium.com/svn/asterisk/branches/1.8

........
  r280879 | tilghman | 2010-08-04 09:04:07 -0500 (Wed, 04 Aug 2010) | 14 lines

  Check cur value before attempting a deref.

  (closes issue #17775)
   Reported by: svinson
   Patches:
         20100804__issue17775.diff.txt uploaded by tilghman (license 14)
   Tested by: svinson

  (closes issue #17743)
   Reported by: tgruenberg
   Patches:
         20100804__issue17775.diff.txt uploaded by tilghman (license 14)
   Tested by: tgruenberg
........

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

channels/chan_mgcp.c

index 485b39a..a787eab 100644 (file)
@@ -3580,7 +3580,7 @@ static int find_and_retrans(struct mgcp_subchannel *sub, struct mgcp_request *re
        if (sscanf(req->identifier, "%30d", &seqno) != 1) {
                seqno = 0;
        }
-       for (cur = sub->parent->parent->responses, next = cur->next; cur; cur = next, next = cur->next) {
+       for (cur = sub->parent->parent->responses, next = cur ? cur->next : NULL; cur; cur = next, next = cur ? cur->next : NULL) {
                if (now - cur->whensent > RESPONSE_TIMEOUT) {
                        /* Delete this entry */
                        if (prev)