[Asterisk-code-review] app_read: Fix null pointer crash (asterisk[18.7])
Friendly Automation
asteriskteam at digium.com
Thu Sep 30 11:13:29 CDT 2021
Friendly Automation has submitted this change. ( https://gerrit.asterisk.org/c/asterisk/+/16556 )
Change subject: app_read: Fix null pointer crash
......................................................................
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
---
M apps/app_read.c
1 file changed, 2 insertions(+), 2 deletions(-)
Approvals:
George Joseph: Looks good to me, approved
Friendly Automation: Approved for Submit
diff --git a/apps/app_read.c b/apps/app_read.c
index dd48f05..977b20d 100644
--- a/apps/app_read.c
+++ b/apps/app_read.c
@@ -154,7 +154,7 @@
struct ast_tone_zone_sound *ts = NULL;
struct ast_flags flags = {0};
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_APP_ARG(variable);
@@ -213,7 +213,7 @@
}
}
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];
} else {
terminator = ""; /* no digit inherently will terminate input */
--
To view, visit https://gerrit.asterisk.org/c/asterisk/+/16556
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings
Gerrit-Project: asterisk
Gerrit-Branch: 18.7
Gerrit-Change-Id: Ie941833e123c3dbfb88371b5de5edbbe065514ac
Gerrit-Change-Number: 16556
Gerrit-PatchSet: 1
Gerrit-Owner: George Joseph <gjoseph at digium.com>
Gerrit-Reviewer: Friendly Automation
Gerrit-Reviewer: George Joseph <gjoseph at digium.com>
Gerrit-CC: N A <mail at interlinked.x10host.com>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20210930/b137bcd9/attachment.html>
More information about the asterisk-code-review
mailing list