summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPau Espin Pedrol <pespin@sysmocom.de>2020-09-18 00:32:01 +0200
committerPau Espin Pedrol <pespin@sysmocom.de>2020-09-18 00:32:01 +0200
commitcebab664a8233964db16c51ed746284d4c18c36b (patch)
treee08895c1601419e55ea3d1c4c3f16c69a114bb69
parentb6cb607d1270b76b5fae5af2a00c4414e86d9f83 (diff)
sdp: Don't select addresses failing to parse
-rw-r--r--src/sdp.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/sdp.c b/src/sdp.c
index 7f91d3f..f1909d4 100644
--- a/src/sdp.c
+++ b/src/sdp.c
@@ -164,20 +164,21 @@ bool sdp_extract_sdp(struct sip_call_leg *leg, const sip_t *sip, bool any_codec)
for (conn = sdp->sdp_connection; conn; conn = conn->c_next) {
switch (conn->c_addrtype) {
case sdp_addr_ip4:
+ if (inet_pton(AF_INET, conn->c_address,
+ &((struct sockaddr_in*)&leg->base.addr)->sin_addr) != 1)
+ continue;
leg->base.addr.ss_family = AF_INET;
- inet_pton(AF_INET, conn->c_address,
- &((struct sockaddr_in*)&leg->base.addr)->sin_addr);
- found_conn = true;
break;
case sdp_addr_ip6:
+ if (inet_pton(AF_INET6, conn->c_address,
+ &((struct sockaddr_in6*)&leg->base.addr)->sin6_addr) != 1)
+ continue;
leg->base.addr.ss_family = AF_INET6;
- inet_pton(AF_INET6, conn->c_address,
- &((struct sockaddr_in6*)&leg->base.addr)->sin6_addr);
- found_conn = true;
break;
default:
continue;
}
+ found_conn = true;
break;
}