Skip to content

Commit b40ca38

Browse files
InterLinked1gtjoseph
authored andcommitted
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
1 parent 6bc747b commit b40ca38

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

apps/app_read.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ static int read_exec(struct ast_channel *chan, const char *data)
154154
struct ast_tone_zone_sound *ts = NULL;
155155
struct ast_flags flags = {0};
156156
const char *status = "ERROR";
157-
char *terminator = NULL; /* use default terminator # by default */
157+
char *terminator = "#"; /* use default terminator # by default */
158158

159159
AST_DECLARE_APP_ARGS(arglist,
160160
AST_APP_ARG(variable);
@@ -213,7 +213,7 @@ static int read_exec(struct ast_channel *chan, const char *data)
213213
}
214214
}
215215
if (ast_test_flag(&flags, OPT_TERMINATOR)) {
216-
if (!ast_strlen_zero(arglist.filename)) {
216+
if (!ast_strlen_zero(opt_args[OPT_ARG_TERMINATOR])) {
217217
terminator = opt_args[OPT_ARG_TERMINATOR];
218218
} else {
219219
terminator = ""; /* no digit inherently will terminate input */

0 commit comments

Comments
 (0)