diff options
author | George Joseph <george.joseph@fairview5.com> | 2014-09-18 14:46:12 +0000 |
---|---|---|
committer | George Joseph <george.joseph@fairview5.com> | 2014-09-18 14:46:12 +0000 |
commit | d120e403092d058dfdb7655ba8e1b8113d3b8a33 (patch) | |
tree | 9831d85d8028fdfe691a4a876ed3d18b3e5c4203 /include/asterisk | |
parent | 8839ba3727cf55018cfeae5ff7ce7d4d758993a2 (diff) |
config: bug: Fix SEGV in ast_category_insert when matching category isn't found
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.
Tested by: George Joseph
Review: https://reviewboard.asterisk.org/r/3993/
........
Merged revisions 423276 from http://svn.asterisk.org/svn/asterisk/branches/1.8
........
Merged revisions 423277 from http://svn.asterisk.org/svn/asterisk/branches/11
........
Merged revisions 423278 from http://svn.asterisk.org/svn/asterisk/branches/12
........
Merged revisions 423279 from http://svn.asterisk.org/svn/asterisk/branches/13
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@423280 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'include/asterisk')
-rw-r--r-- | include/asterisk/config.h | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/include/asterisk/config.h b/include/asterisk/config.h index 2579ef279..541fea4ff 100644 --- a/include/asterisk/config.h +++ b/include/asterisk/config.h @@ -675,8 +675,11 @@ void ast_category_append(struct ast_config *config, struct ast_category *cat); * \details * This function is used to insert a new category above another category * matching the match parameter. + * + * \retval 0 if succeeded + * \retval -1 if NULL parameters or match category was not found */ -void ast_category_insert(struct ast_config *config, struct ast_category *cat, const char *match); +int ast_category_insert(struct ast_config *config, struct ast_category *cat, const char *match); int ast_category_delete(struct ast_config *cfg, const char *category); /*! |