]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
chan_sip: Fix port parsing for IPv6 addresses in SIP Via headers. 99/1399/1
authorFlorian Sauerteig <ffs@ccn.net>
Tue, 6 Oct 2015 17:40:22 +0000 (19:40 +0200)
committerRichard Mudgett <rmudgett@digium.com>
Tue, 6 Oct 2015 21:34:07 +0000 (16:34 -0500)
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

channels/sip/reqresp_parser.c

index e5c1ff2bca3f34897bd951e1c7cdc7e3b5e7510d..31832a33ad4d7cd87dfc1b683172b138eac0c5ef 100644 (file)
@@ -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);