[Asterisk-code-review] res pjsip/res pjsip callerid: NULL check on caller id name s... (asterisk[13])
Kevin Harwell
asteriskteam at digium.com
Wed Apr 26 14:25:55 CDT 2017
Kevin Harwell has uploaded a new change for review. ( https://gerrit.asterisk.org/5541 )
Change subject: res_pjsip/res_pjsip_callerid: NULL check on caller id name string
......................................................................
res_pjsip/res_pjsip_callerid: NULL check on caller id name string
It's possible for a name in a party id structure to be marked as valid, but the
name string itself be NULL. There were a couple of places where the name was
validated, but the string itself was not checked before passing it to functions
like 'strlen'. This of course caused a crashed.
This patch adds in a NULL check before attempting to pass it into a function
that is not NULL tolerant.
ASTERISK-25823 #close
Change-Id: Iaa6ffe9d92f598fe9e3c8ae373fadbe3dfbf1d4a
---
M res/res_pjsip.c
M res/res_pjsip_caller_id.c
2 files changed, 2 insertions(+), 2 deletions(-)
git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/41/5541/1
diff --git a/res/res_pjsip.c b/res/res_pjsip.c
index fc49856..555786c 100644
--- a/res/res_pjsip.c
+++ b/res/res_pjsip.c
@@ -4379,7 +4379,7 @@
id_name_addr = (pjsip_name_addr *) id_hdr->uri;
id_uri = pjsip_uri_get_uri(id_name_addr->uri);
- if (id->name.valid) {
+ if (id->name.valid && !ast_strlen_zero(id->name.str)) {
int name_buf_len = strlen(id->name.str) * 2 + 1;
char *name_buf = ast_alloca(name_buf_len);
diff --git a/res/res_pjsip_caller_id.c b/res/res_pjsip_caller_id.c
index 1b453cf..7dcdcde 100644
--- a/res/res_pjsip_caller_id.c
+++ b/res/res_pjsip_caller_id.c
@@ -436,7 +436,7 @@
id_name_addr = pjsip_uri_clone(tdata->pool, base->uri);
id_uri = pjsip_uri_get_uri(id_name_addr->uri);
- if (id->name.valid) {
+ if (id->name.valid && !ast_strlen_zero(id->name.str)) {
int name_buf_len = strlen(id->name.str) * 2 + 1;
char *name_buf = ast_alloca(name_buf_len);
--
To view, visit https://gerrit.asterisk.org/5541
To unsubscribe, visit https://gerrit.asterisk.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Iaa6ffe9d92f598fe9e3c8ae373fadbe3dfbf1d4a
Gerrit-PatchSet: 1
Gerrit-Project: asterisk
Gerrit-Branch: 13
Gerrit-Owner: Kevin Harwell <kharwell at digium.com>
More information about the asterisk-code-review
mailing list