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

N A asteriskteam at digium.com
Wed Sep 29 13:05:45 CDT 2021


N A has uploaded this change for review. ( https://gerrit.asterisk.org/c/asterisk/+/16548 )


Change subject: app_read: Fix null pointer crash
......................................................................

app_read: Fix null pointer crash

If the terminator character is explicitly removed,
there is no null pointer check so Asterisk crashes.
This adds the null check to prevent crashes.

ASTERISK-29673 #close

Change-Id: Ie941833e123c3dbfb88371b5de5edbbe065514ac
---
M apps/app_read.c
1 file changed, 1 insertion(+), 1 deletion(-)



  git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/48/16548/1

diff --git a/apps/app_read.c b/apps/app_read.c
index dd48f05..bc1df21 100644
--- a/apps/app_read.c
+++ b/apps/app_read.c
@@ -250,7 +250,7 @@
 						break;
 					}
 					tmp[x++] = res;
-					if (strchr(terminator, tmp[x-1])) {
+					if (terminator && strchr(terminator, tmp[x-1])) {
 						tmp[x-1] = '\0';
 						status = "OK";
 						break;

-- 
To view, visit https://gerrit.asterisk.org/c/asterisk/+/16548
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings

Gerrit-Project: asterisk
Gerrit-Branch: 16
Gerrit-Change-Id: Ie941833e123c3dbfb88371b5de5edbbe065514ac
Gerrit-Change-Number: 16548
Gerrit-PatchSet: 1
Gerrit-Owner: 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/20210929/5931655b/attachment-0001.html>


More information about the asterisk-code-review mailing list