[Asterisk-code-review] ice: Increase foundation buffer size (asterisk[15])

Joshua Colp asteriskteam at digium.com
Tue Jan 2 07:47:54 CST 2018


Joshua Colp has submitted this change and it was merged. ( https://gerrit.asterisk.org/7776 )

Change subject: ice: Increase foundation buffer size
......................................................................

ice: Increase foundation buffer size

Per RFC 5245, the foundation specified with an ICE candidate can be up
to 32 characters but we are only allowing for 31.

ASTERISK-27498 #close
Reported by: Michele Prà

Change-Id: I05ce7a5952721a76a2b4c90366168022558dc7cf
---
M channels/chan_sip.c
M res/res_pjsip_sdp_rtp.c
2 files changed, 4 insertions(+), 4 deletions(-)

Approvals:
  Corey Farrell: Looks good to me, but someone else must approve
  Joshua Colp: Looks good to me, approved; Approved for Submit



diff --git a/channels/chan_sip.c b/channels/chan_sip.c
index eee873b..1aa47e2 100644
--- a/channels/chan_sip.c
+++ b/channels/chan_sip.c
@@ -11296,7 +11296,7 @@
 {
 	struct ast_rtp_engine_ice *ice;
 	int found = FALSE;
-	char ufrag[256], pwd[256], foundation[32], transport[4], address[46], cand_type[6], relay_address[46] = "";
+	char ufrag[256], pwd[256], foundation[33], transport[4], address[46], cand_type[6], relay_address[46] = "";
 	struct ast_rtp_engine_ice_candidate candidate = { 0, };
 	unsigned int port, relay_port = 0;
 
@@ -11310,7 +11310,7 @@
 	} else if (sscanf(a, "ice-pwd: %255s", pwd) == 1) {
 		ice->set_authentication(instance, NULL, pwd);
 		found = TRUE;
-	} else if (sscanf(a, "candidate: %31s %30u %3s %30u %23s %30u typ %5s %*s %23s %*s %30u", foundation, &candidate.id, transport, (unsigned *)&candidate.priority,
+	} else if (sscanf(a, "candidate: %32s %30u %3s %30u %23s %30u typ %5s %*s %23s %*s %30u", foundation, &candidate.id, transport, (unsigned *)&candidate.priority,
 			  address, &port, cand_type, relay_address, &relay_port) >= 7) {
 
 		if (rtcp_mux_offered && ast_test_flag(&p->flags[2], SIP_PAGE3_RTCP_MUX) && candidate.id > 1) {
diff --git a/res/res_pjsip_sdp_rtp.c b/res/res_pjsip_sdp_rtp.c
index 854ed14..9e04119 100644
--- a/res/res_pjsip_sdp_rtp.c
+++ b/res/res_pjsip_sdp_rtp.c
@@ -627,7 +627,7 @@
 
 	/* Find all of the candidates */
 	for (attr_i = 0; attr_i < remote_stream->attr_count; ++attr_i) {
-		char foundation[32], transport[32], address[PJ_INET6_ADDRSTRLEN + 1], cand_type[6], relay_address[PJ_INET6_ADDRSTRLEN + 1] = "";
+		char foundation[33], transport[32], address[PJ_INET6_ADDRSTRLEN + 1], cand_type[6], relay_address[PJ_INET6_ADDRSTRLEN + 1] = "";
 		unsigned int port, relay_port = 0;
 		struct ast_rtp_engine_ice_candidate candidate = { 0, };
 
@@ -640,7 +640,7 @@
 
 		ast_copy_pj_str(attr_value, (pj_str_t*)&attr->value, sizeof(attr_value));
 
-		if (sscanf(attr_value, "%31s %30u %31s %30u %46s %30u typ %5s %*s %23s %*s %30u", foundation, &candidate.id, transport,
+		if (sscanf(attr_value, "%32s %30u %31s %30u %46s %30u typ %5s %*s %23s %*s %30u", foundation, &candidate.id, transport,
 			(unsigned *)&candidate.priority, address, &port, cand_type, relay_address, &relay_port) < 7) {
 			/* Candidate did not parse properly */
 			continue;

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

Gerrit-Project: asterisk
Gerrit-Branch: 15
Gerrit-MessageType: merged
Gerrit-Change-Id: I05ce7a5952721a76a2b4c90366168022558dc7cf
Gerrit-Change-Number: 7776
Gerrit-PatchSet: 1
Gerrit-Owner: Sean Bright <sean.bright at gmail.com>
Gerrit-Reviewer: Corey Farrell <git at cfware.com>
Gerrit-Reviewer: Jenkins2
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20180102/828f4514/attachment.html>


More information about the asterisk-code-review mailing list