Add test for negative offsets in cid data to prevent infinite loops.

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@63750 65c4cc65-6c06-0410-ace0-fbb531ad65f3
1.4
Doug Bailey 18 years ago
parent ca1ae5e81a
commit a75d0f5329

@ -660,6 +660,12 @@ int callerid_feed(struct callerid_state *cid, unsigned char *ubuf, int len, int
default:
ast_log(LOG_NOTICE, "Unknown IE %d\n", cid->rawdata[x-1]);
}
if(0 > cid->rawdata[x]){ /* Negative offset in the CID Spill */
ast_log(LOG_NOTICE, "IE %d has bad field length of %d at offset %d\n", cid->rawdata[x-1], cid->rawdata[x], x);
/* Try again */
cid->sawflag = 0;
break; /* Exit the loop */
}
x += cid->rawdata[x];
x++;
}

Loading…
Cancel
Save