chan_sip: Fix port parsing for IPv6 addresses in SIP Via headers.

If a Via header containes an IPv6 address and a port number is ommitted,
as it is the standard port, we now leave the port empty and to not set it
to the value after the first colon of the IPv6 address.

ASTERISK-25443 #close

Change-Id: Ie3c2f05471cd006bf04ed15598589c09577b1e70
changes/00/1400/1
Florian Sauerteig 10 years ago committed by Richard Mudgett
parent 52f413f709
commit 3ec9cf7d6a

@ -2420,7 +2420,7 @@ struct sip_via *parse_via(const char *header)
/* store the port, we have to handle ipv6 addresses containing ':'
* characters gracefully */
if (((parm = strchr(v->sent_by, ']')) && *(++parm) == ':') || (parm = strchr(v->sent_by, ':'))) {
if (((parm = strchr(v->sent_by, ']')) && *(++parm) == ':') || (!(parm = strchr(v->sent_by, ']')) && (parm = strchr(v->sent_by, ':')))) {
char *endptr;
v->port = strtol(++parm, &endptr, 10);

Loading…
Cancel
Save