Fix Coverity ID 871 -- do not dereference "sp" before checking for NULL
authorVolker Lendecke <vl@samba.org>
Thu, 12 Feb 2009 22:19:45 +0000 (23:19 +0100)
committerVolker Lendecke <vl@samba.org>
Thu, 12 Feb 2009 22:20:20 +0000 (23:20 +0100)
source4/lib/socket/socket_ip.c

index cdb75fe0218d945714f520ebc8f505126db6b4bf..89b310a23afcd5c9ef25e7df17d55059c36e3c68 100644 (file)
@@ -552,11 +552,13 @@ static struct in6_addr interpret_addr6(const char *name)
        char addr[INET6_ADDRSTRLEN];
        struct in6_addr dest6;
        const char *sp = name;
-       char *p = strchr_m(sp, '%');
+       char *p;
        int ret;
 
        if (sp == NULL) return in6addr_any;
 
+       p = strchr_m(sp, '%');
+
        if (strcasecmp(sp, "localhost") == 0) {
                sp = "::1";
        }