[asterisk-dev] [Code Review] 3993: config: bug: Fix SEGV in ast_category_insert when a matching category isn't found
Matt Jordan
reviewboard at asterisk.org
Mon Sep 15 09:33:46 CDT 2014
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviewboard.asterisk.org/r/3993/#review13298
-----------------------------------------------------------
branches/1.8/main/config.c
<https://reviewboard.asterisk.org/r/3993/#comment23774>
Any reason not to move this into the for loop condition?
for (... ; cur_category && cur_category->next; ...) {
...
}
- Matt Jordan
On Sept. 14, 2014, 6:02 p.m., George Joseph wrote:
>
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviewboard.asterisk.org/r/3993/
> -----------------------------------------------------------
>
> (Updated Sept. 14, 2014, 6:02 p.m.)
>
>
> Review request for Asterisk Developers.
>
>
> Repository: Asterisk
>
>
> Description
> -------
>
> If you call ast_category_insert with a match category that doesn't exist, the list traverse runs out of 'next' categories and you get a SEGV. This patch adds check for the end-of-list condition and changes the signature to return an int for success/failure indication instead of a void.
>
> The only consumer of this function is manager and it was also changed to use the return value.
>
>
> Diffs
> -----
>
> branches/1.8/main/manager.c 423127
> branches/1.8/main/config.c 423127
> branches/1.8/include/asterisk/config.h 423127
>
> Diff: https://reviewboard.asterisk.org/r/3993/diff/
>
>
> Testing
> -------
>
> Tested with AMI UpdateConfig/newcat to make sure the proper value is returned in both positive and negative cases.
>
>
> Thanks,
>
> George Joseph
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-dev/attachments/20140915/f79edb52/attachment.html>
More information about the asterisk-dev
mailing list