diff options
author | Matthew Jordan <mjordan@digium.com> | 2012-05-17 13:21:19 +0000 |
---|---|---|
committer | Matthew Jordan <mjordan@digium.com> | 2012-05-17 13:21:19 +0000 |
commit | 87113f1a0c775a4f4d7cc018e049be39cbbd39f1 (patch) | |
tree | e2de534e69cc50752a5212b8ef5d709c97d65521 /res/res_calendar_ews.c | |
parent | 2d175b7e8f133a0b830564e1a4147906d65f1bb0 (diff) |
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
........
Merged revisions 366741 from http://svn.asterisk.org/svn/asterisk/branches/10
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@366746 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'res/res_calendar_ews.c')
-rw-r--r-- | res/res_calendar_ews.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/res/res_calendar_ews.c b/res/res_calendar_ews.c index d33f4be4f..7deca9c97 100644 --- a/res/res_calendar_ews.c +++ b/res/res_calendar_ews.c @@ -233,7 +233,7 @@ static int startelm(void *userdata, int parent, const char *nspace, const char * /* Event UID */ if (ctx->op == XML_OP_FIND) { struct calendar_id *id; - if (!(id = ast_calloc(1, sizeof(id)))) { + if (!(id = ast_calloc(1, sizeof(*id)))) { return NE_XML_ABORT; } if (!(id->id = ast_str_create(256))) { |