[asterisk-commits] res pjsip sdp rtp.c: Don't alter global addr variable. (asterisk[master])
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Tue Apr 4 17:53:16 CDT 2017
Anonymous Coward #1000019 has submitted this change and it was merged. ( https://gerrit.asterisk.org/5401 )
Change subject: res_pjsip_sdp_rtp.c: Don't alter global addr variable.
......................................................................
res_pjsip_sdp_rtp.c: Don't alter global addr variable.
* create_rtp(): Fix unexpected alteration of global address_rtp if a
transport is bound to an address.
* create_rtp(): Fix use of uninitialized memory if the endpoint RTP media
address is invalid or the transport has an invalid address.
ASTERISK-26851
Change-Id: Icde42e65164a88913cb5c2601b285eebcff397b7
---
M res/res_pjsip_sdp_rtp.c
1 file changed, 18 insertions(+), 5 deletions(-)
Approvals:
Mark Michelson: Looks good to me, approved
George Joseph: Looks good to me, but someone else must approve
Anonymous Coward #1000019: Verified
Joshua Colp: Looks good to me, but someone else must approve
diff --git a/res/res_pjsip_sdp_rtp.c b/res/res_pjsip_sdp_rtp.c
index 21de440..701edc3 100644
--- a/res/res_pjsip_sdp_rtp.c
+++ b/res/res_pjsip_sdp_rtp.c
@@ -198,8 +198,16 @@
struct ast_sockaddr *media_address = &address_rtp;
if (session->endpoint->media.bind_rtp_to_media_address && !ast_strlen_zero(session->endpoint->media.address)) {
- ast_sockaddr_parse(&temp_media_address, session->endpoint->media.address, 0);
- media_address = &temp_media_address;
+ if (ast_sockaddr_parse(&temp_media_address, session->endpoint->media.address, 0)) {
+ ast_debug(1, "Endpoint %s: Binding RTP media to %s\n",
+ ast_sorcery_object_get_id(session->endpoint),
+ session->endpoint->media.address);
+ media_address = &temp_media_address;
+ } else {
+ ast_debug(1, "Endpoint %s: RTP media address invalid: %s\n",
+ ast_sorcery_object_get_id(session->endpoint),
+ session->endpoint->media.address);
+ }
} else {
struct ast_sip_transport *transport =
ast_sorcery_retrieve_by_id(ast_sip_get_sorcery(), "transport",
@@ -209,9 +217,14 @@
char hoststr[PJ_INET6_ADDRSTRLEN];
pj_sockaddr_print(&transport->state->host, hoststr, sizeof(hoststr), 0);
- ast_debug(1, "Transport: %s bound to host: %s, using this for media.\n",
- session->endpoint->transport, hoststr);
- ast_sockaddr_parse(media_address, hoststr, 0);
+ if (ast_sockaddr_parse(&temp_media_address, hoststr, 0)) {
+ ast_debug(1, "Transport %s bound to %s: Using it for RTP media.\n",
+ session->endpoint->transport, hoststr);
+ media_address = &temp_media_address;
+ } else {
+ ast_debug(1, "Transport %s bound to %s: Invalid for RTP media.\n",
+ session->endpoint->transport, hoststr);
+ }
}
ao2_cleanup(transport);
}
--
To view, visit https://gerrit.asterisk.org/5401
To unsubscribe, visit https://gerrit.asterisk.org/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Icde42e65164a88913cb5c2601b285eebcff397b7
Gerrit-PatchSet: 1
Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-Owner: Richard Mudgett <rmudgett at digium.com>
Gerrit-Reviewer: Anonymous Coward #1000019
Gerrit-Reviewer: George Joseph <gjoseph at digium.com>
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>
Gerrit-Reviewer: Mark Michelson <mmichelson at digium.com>
More information about the asterisk-commits
mailing list