[Asterisk-code-review] app_read: Fix null pointer crash (asterisk[16.21])

George Joseph asteriskteam at digium.com
Thu Sep 30 10:18:52 CDT 2021


George Joseph has uploaded this change for review. ( https://gerrit.asterisk.org/c/asterisk/+/16555 )


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(-)



  git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/55/16555/1

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/+/16555
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings

Gerrit-Project: asterisk
Gerrit-Branch: 16.21
Gerrit-Change-Id: Ie941833e123c3dbfb88371b5de5edbbe065514ac
Gerrit-Change-Number: 16555
Gerrit-PatchSet: 1
Gerrit-Owner: George Joseph <gjoseph at digium.com>
Gerrit-CC: N A <mail at interlinked.x10host.com>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20210930/ea0b56c0/attachment.html>


More information about the asterisk-code-review mailing list