[Asterisk-code-review] CHAOS: tolerate null to string gracefully (asterisk[master])

Scott Griepentrog asteriskteam at digium.com
Wed Mar 2 13:18:35 CST 2016


Scott Griepentrog has uploaded a new change for review.

  https://gerrit.asterisk.org/2345

Change subject: CHAOS: tolerate null to string gracefully
......................................................................

CHAOS: tolerate null to string gracefully

This patch checks for a null to string to invoke a
graceful failure rather than a segfault.

ASTERISK-25323

Change-Id: I7fb89e542349a7aed870b7e67433f61a74cb5389
---
M res/res_pjsip_messaging.c
1 file changed, 3 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/45/2345/1

diff --git a/res/res_pjsip_messaging.c b/res/res_pjsip_messaging.c
index 7532e39..36188cf 100644
--- a/res/res_pjsip_messaging.c
+++ b/res/res_pjsip_messaging.c
@@ -124,6 +124,9 @@
 	RAII_VAR(struct ast_sip_aor *, aor, NULL, ao2_cleanup);
 	RAII_VAR(struct ast_sip_contact *, contact, NULL, ao2_cleanup);
 
+	if (ast_strlen_zero(to)) {
+		return NULL;
+	}
 	name = ast_strdupa(skip_sip(to));
 
 	/* attempt to extract the endpoint name */

-- 
To view, visit https://gerrit.asterisk.org/2345
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I7fb89e542349a7aed870b7e67433f61a74cb5389
Gerrit-PatchSet: 1
Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-Owner: Scott Griepentrog <sgriepentrog at digium.com>



More information about the asterisk-code-review mailing list