[Asterisk-code-review] app_voicemail: ensure strings are not NULL/empty before using (asterisk[13])
Kevin Harwell
asteriskteam at digium.com
Tue Aug 25 12:10:20 CDT 2020
Kevin Harwell has uploaded this change for review. ( https://gerrit.asterisk.org/c/asterisk/+/14810 )
Change subject: app_voicemail: ensure strings are not NULL/empty before using
......................................................................
app_voicemail: ensure strings are not NULL/empty before using
The handle_subscribe function was not checking the passed in strings for
NULL in all cases. This patch now checks and makes sure those strings are
not NULL/empty before being used.
Change-Id: I61da04fe2c2bee0a02480f43301203f31de511c0
---
M apps/app_voicemail.c
1 file changed, 5 insertions(+), 4 deletions(-)
git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/10/14810/1
diff --git a/apps/app_voicemail.c b/apps/app_voicemail.c
index e7e0a5c..d62882f 100644
--- a/apps/app_voicemail.c
+++ b/apps/app_voicemail.c
@@ -13379,20 +13379,21 @@
unsigned int len;
struct mwi_sub *mwi_sub;
struct mwi_sub_task *p = datap;
- size_t context_len;
+ size_t context_len = 0;
len = sizeof(*mwi_sub) + 1;
if (!ast_strlen_zero(p->mailbox))
len += strlen(p->mailbox);
- context_len = strlen(p->context) + 1; /* Allow for seperator */
- if (!ast_strlen_zero(p->context))
+ if (!ast_strlen_zero(p->context)) {
+ context_len = strlen(p->context) + 1; /* Allow for separator */
len += context_len;
+ }
if (!(mwi_sub = ast_calloc(1, len)))
return -1;
- mwi_sub->uniqueid = ast_strdup(p->uniqueid);
+ mwi_sub->uniqueid = ast_strdup(p->uniqueid ? p->uniqueid : "");
if (!ast_strlen_zero(p->mailbox))
strcpy(mwi_sub->mailbox, p->mailbox);
--
To view, visit https://gerrit.asterisk.org/c/asterisk/+/14810
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings
Gerrit-Project: asterisk
Gerrit-Branch: 13
Gerrit-Change-Id: I61da04fe2c2bee0a02480f43301203f31de511c0
Gerrit-Change-Number: 14810
Gerrit-PatchSet: 1
Gerrit-Owner: Kevin Harwell <kharwell at digium.com>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20200825/6a95f1d4/attachment.html>
More information about the asterisk-code-review
mailing list