]> 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:51:36 +0000 (12:51 +0000)
committerMatthew Jordan <mjordan@digium.com>
Thu, 17 May 2012 12:51:36 +0000 (12:51 +0000)
commit7eb528fbf14e2963072d4bcb45735fbd885964c3
tree90d97fe4391d252508a60f15de714ac646d7e94e
parent82a5bbceceb6d3e0f1b4088ae783b68c344d4eff
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

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