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

Friendly Automation asteriskteam at digium.com
Thu Sep 30 11:09:37 CDT 2021


Friendly Automation has submitted this change. ( https://gerrit.asterisk.org/c/asterisk/+/16550 )

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:
  Joshua Colp: Looks good to me, but someone else must approve
  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/+/16550
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings

Gerrit-Project: asterisk
Gerrit-Branch: 19
Gerrit-Change-Id: Ie941833e123c3dbfb88371b5de5edbbe065514ac
Gerrit-Change-Number: 16550
Gerrit-PatchSet: 5
Gerrit-Owner: N A <mail at interlinked.x10host.com>
Gerrit-Reviewer: Friendly Automation
Gerrit-Reviewer: George Joseph <gjoseph at digium.com>
Gerrit-Reviewer: Joshua Colp <jcolp at sangoma.com>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20210930/41798242/attachment-0001.html>


More information about the asterisk-code-review mailing list