mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-05 12:16:00 +00:00
app_read: Fix null pointer crash
If the terminator character is not explicitly specified and an indications tone is used for reading a digit, there is no null pointer check so Asterisk crashes. This prevents null usage from occuring. ASTERISK-29673 #close Change-Id: Ie941833e123c3dbfb88371b5de5edbbe065514ac
This commit is contained in:
committed by
Friendly Automation
parent
576119e076
commit
60bbfe4572
@@ -154,7 +154,7 @@ static int read_exec(struct ast_channel *chan, const char *data)
|
|||||||
struct ast_tone_zone_sound *ts = NULL;
|
struct ast_tone_zone_sound *ts = NULL;
|
||||||
struct ast_flags flags = {0};
|
struct ast_flags flags = {0};
|
||||||
const char *status = "ERROR";
|
const char *status = "ERROR";
|
||||||
char *terminator = NULL; /* use default terminator # by default */
|
char *terminator = "#"; /* use default terminator # by default */
|
||||||
|
|
||||||
AST_DECLARE_APP_ARGS(arglist,
|
AST_DECLARE_APP_ARGS(arglist,
|
||||||
AST_APP_ARG(variable);
|
AST_APP_ARG(variable);
|
||||||
@@ -213,7 +213,7 @@ static int read_exec(struct ast_channel *chan, const char *data)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (ast_test_flag(&flags, OPT_TERMINATOR)) {
|
if (ast_test_flag(&flags, OPT_TERMINATOR)) {
|
||||||
if (!ast_strlen_zero(arglist.filename)) {
|
if (!ast_strlen_zero(opt_args[OPT_ARG_TERMINATOR])) {
|
||||||
terminator = opt_args[OPT_ARG_TERMINATOR];
|
terminator = opt_args[OPT_ARG_TERMINATOR];
|
||||||
} else {
|
} else {
|
||||||
terminator = ""; /* no digit inherently will terminate input */
|
terminator = ""; /* no digit inherently will terminate input */
|
||||||
|
Reference in New Issue
Block a user