]> git.ipfire.org Git - thirdparty/asterisk.git/commit
Fix checking bounds of array index after using it; improper sizeof
authorMatthew Jordan <mjordan@digium.com>
Thu, 17 May 2012 12:57:30 +0000 (12:57 +0000)
committerMatthew Jordan <mjordan@digium.com>
Thu, 17 May 2012 12:57:30 +0000 (12:57 +0000)
commit33705eff86e750b2dde686fcdf46fbc39ca96248
treeb79f09de6434c59657ca3435f62ddb8da7a40bc8
parent90b2dabd092861c583fe7ad51fd860140f49b938
Fix checking bounds of array index after using it; improper sizeof

This patch fixes two problems pointed out by a static analysis tool.

* In chan_dahdi, when an event is handled the index of the sub channel is first
  obtained.  In very off nominal cases, the method that determines the index
  can return a negative value.  In the event handling code, whether or not
  the index returned is valid was being checked after that value was used to
  index into an array.  This patch makes it so the value is checked before
  any indexing is done.

* In res_calendar_ews, sizeof was being passed a pointer instead of the struct to
  determine the amount of memory to allocate.

(issue ASTERISK-19651)
Reported by: Matt Jordan

(closes issue ASTERISK-19671)
Reported by: Matt Jordan
........

Merged revisions 366740 from http://svn.asterisk.org/svn/asterisk/branches/1.8

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/10@366741 65c4cc65-6c06-0410-ace0-fbb531ad65f3
channels/chan_dahdi.c
res/res_calendar_ews.c