]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
app_adsiprog: Fix possible NULL dereference.
authorNaveen Albert <asterisk@phreaknet.org>
Wed, 10 Sep 2025 16:15:08 +0000 (12:15 -0400)
committerNaveen Albert <asterisk@phreaknet.org>
Thu, 11 Sep 2025 15:25:34 +0000 (15:25 +0000)
get_token can return NULL, but process_token uses this result without
checking for NULL; as elsewhere, check for a NULL result to avoid
possible NULL dereference.

Resolves: #1419

apps/app_adsiprog.c

index 291ce70ff7f9e3add4fc73bb56a24c43fcce6c47..10ff8f0ab289401486181f482a4e9b37908c9315 100644 (file)
@@ -848,7 +848,10 @@ static int onevent(char *buf, char *name, int id, char *args, struct adsi_script
                        return 0;
                }
                /* Process 'in' things */
-               tok = get_token(&args, script, lineno);
+               if (!(tok = get_token(&args, script, lineno))) {
+                       ast_log(LOG_WARNING, "Missing state name at line %d of %s\n", lineno, script);
+                       return 0;
+               }
                if (process_token(sname, tok, sizeof(sname), ARG_STRING)) {
                        ast_log(LOG_WARNING, "'%s' is not a valid state name at line %d of %s\n", tok, lineno, script);
                        return 0;