]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
FS-535: be more careful and catch ipv6 edge case
authorBrian West <brian@freeswitch.org>
Mon, 22 Nov 2010 21:32:23 +0000 (15:32 -0600)
committerBrian West <brian@freeswitch.org>
Mon, 22 Nov 2010 21:32:23 +0000 (15:32 -0600)
src/mod/endpoints/mod_sofia/sofia_glue.c

index 23d3f2904e79f826d6481802c5d574be0c8ff08c..57a2bfaa6a477e0928726b42fce7d6d1d6372aa0 100644 (file)
@@ -5740,6 +5740,10 @@ char *sofia_glue_get_register_host(const char *uri)
        const char *s;
        char *p = NULL;
 
+       if (zstr(uri)) {
+               return NULL;
+       }
+
        if ((s = switch_stristr("sip:", uri))) {
                s += 4;
        } else if ((s = switch_stristr("sips:", uri))) {
@@ -5755,9 +5759,12 @@ char *sofia_glue_get_register_host(const char *uri)
        /* remove port for register_host for testing nat acl take into account 
           ipv6 addresses which are required to have brackets around the addr 
        */
-       if ((p = strchr(register_host, ']')) && (*(p + 1) == ':')) {
-               *(p + 1) = '\0';
-       } else { 
+       
+       if ((p = strchr(register_host, ']'))) {
+               if (*(p + 1) == ':') {
+                       *(p + 1) = '\0';
+               }
+       } else {
                if ((p = strrchr(register_host, ':'))) {
                        *p = '\0';
                }