[Asterisk-code-review] res_pjsip: Prevent segfault in UDP registration with flow transports (asterisk[18])

Friendly Automation asteriskteam at digium.com
Mon Jan 4 05:03:12 CST 2021


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

Change subject: res_pjsip: Prevent segfault in UDP registration with flow transports
......................................................................

res_pjsip: Prevent segfault in UDP registration with flow transports

Segfault occurs during outbound UDP registration when all
transport states are being iterated over. The transport object
in the transport is accessed, but flow transports have a NULL
transport object.

Modify to not iterate over any flow transport

ASTERISK-29210 #close

Change-Id: If28dc3a18bdcbd0a49598b09b7fe4404d45c996a
---
M res/res_pjsip/pjsip_message_filter.c
1 file changed, 2 insertions(+), 1 deletion(-)

Approvals:
  Joshua Colp: Looks good to me, approved
  Sean Bright: Looks good to me, but someone else must approve
  Friendly Automation: Approved for Submit



diff --git a/res/res_pjsip/pjsip_message_filter.c b/res/res_pjsip/pjsip_message_filter.c
index 1826ee2..7c91ba8 100644
--- a/res/res_pjsip/pjsip_message_filter.c
+++ b/res/res_pjsip/pjsip_message_filter.c
@@ -111,7 +111,8 @@
 	}
 
 	for (iter = ao2_iterator_init(transport_states, 0); (transport_state = ao2_iterator_next(&iter)); ao2_ref(transport_state, -1)) {
-		if (transport_state->type == AST_TRANSPORT_UDP &&
+		if (!transport_state->flow &&
+			transport_state->type == AST_TRANSPORT_UDP &&
 			!pj_strcmp(&transport_state->transport->local_name.host, address) &&
 			transport_state->transport->local_name.port == port) {
 			sip_transport = transport_state->transport;

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

Gerrit-Project: asterisk
Gerrit-Branch: 18
Gerrit-Change-Id: If28dc3a18bdcbd0a49598b09b7fe4404d45c996a
Gerrit-Change-Number: 15256
Gerrit-PatchSet: 3
Gerrit-Owner: Nick French <naf at ou.edu>
Gerrit-Reviewer: Friendly Automation
Gerrit-Reviewer: Joshua Colp <jcolp at sangoma.com>
Gerrit-Reviewer: Nick French <nickfrench at gmail.com>
Gerrit-Reviewer: Sean Bright <sean.bright at gmail.com>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20210104/a8db4306/attachment.html>


More information about the asterisk-code-review mailing list