]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
chan_sip: Fix port parsing for IPv6 addresses in SIP Via headers. 91/1391/2
authorFlorian Sauerteig <ffs@ccn.net>
Tue, 6 Oct 2015 17:40:22 +0000 (19:40 +0200)
committerMatt Jordan <mjordan@digium.com>
Tue, 6 Oct 2015 18:05:20 +0000 (13:05 -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 42bb04deb56510d08dcbfc8305f31a9788bbba5e..9b435d00c9fe49cb7cdb02a593cdbe93bc907e2e 100644 (file)
@@ -2323,7 +2323,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);