]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
don't segfault when an argument without a close parenthesis is found
authorKevin P. Fleming <kpfleming@digium.com>
Thu, 5 Oct 2006 16:10:01 +0000 (16:10 +0000)
committerKevin P. Fleming <kpfleming@digium.com>
Thu, 5 Oct 2006 16:10:01 +0000 (16:10 +0000)
stop parsing as soon as that situation occurs

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@44476 65c4cc65-6c06-0410-ace0-fbb531ad65f3

main/app.c

index b6a7f73a9a5caa8b1c96ef5eadf00037fcdd6869..e640a762e1bf769914ccd6ac1229d8474119aac9 100644 (file)
@@ -1302,14 +1302,14 @@ int ast_app_parse_options(const struct ast_app_option *options, struct ast_flags
                if (*s == '(') {
                        /* Has argument */
                        arg = ++s;
-                       s = strchr(s, ')');
-                       if (*s) {
+                       if ((s = strchr(s, ')'))) {
                                if (argloc)
                                        args[argloc - 1] = arg;
                                *s++ = '\0';
                        } else {
                                ast_log(LOG_WARNING, "Missing closing parenthesis for argument '%c' in string '%s'\n", curarg, arg);
                                res = -1;
+                               break;
                        }
                } else if (argloc) {
                        args[argloc - 1] = NULL;