]> git.ipfire.org Git - thirdparty/bird.git/commitdiff
ip_pton: Avoid modification of the string we're converting.
authorMartin Mares <mj@ucw.cz>
Tue, 6 Apr 1999 21:31:03 +0000 (21:31 +0000)
committerMartin Mares <mj@ucw.cz>
Tue, 6 Apr 1999 21:31:03 +0000 (21:31 +0000)
lib/ipv4.c

index 54e1adb35f5d44ccf5ad24fee4f2b9bd456bbee4..04e15b0534b1c658a83db5bd282e70ed1a8c18e1 100644 (file)
@@ -81,12 +81,12 @@ ip_pton(char *a, ip_addr *o)
       char *d, *c = strchr(a, '.');
       if (!c != !i)
        return 0;
-      if (c)
-       *c++ = 0;
       l = strtoul(a, &d, 10);
-      if (d && *d || l > 255)
+      if (d != c && *d || l > 255)
        return 0;
       ia = (ia << 8) | l;
+      if (c)
+       c++;
       a = c;
     }
   *o = ipa_from_u32(ia);