app_adsiprog: Fix possible NULL dereference.

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
This commit is contained in:
Naveen Albert
2025-09-10 12:15:08 -04:00
committed by github-actions[bot]
parent 170048a41e
commit 4aad564b93

View File

@@ -848,7 +848,10 @@ static int onevent(char *buf, char *name, int id, char *args, struct adsi_script
return 0; return 0;
} }
/* Process 'in' things */ /* 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)) { 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); ast_log(LOG_WARNING, "'%s' is not a valid state name at line %d of %s\n", tok, lineno, script);
return 0; return 0;