ip_pton: Avoid modification of the string we're converting.
This commit is contained in:
parent
e2dc2f30ef
commit
7976a574b6
1 changed files with 3 additions and 3 deletions
|
@ -81,12 +81,12 @@ ip_pton(char *a, ip_addr *o)
|
||||||
char *d, *c = strchr(a, '.');
|
char *d, *c = strchr(a, '.');
|
||||||
if (!c != !i)
|
if (!c != !i)
|
||||||
return 0;
|
return 0;
|
||||||
if (c)
|
|
||||||
*c++ = 0;
|
|
||||||
l = strtoul(a, &d, 10);
|
l = strtoul(a, &d, 10);
|
||||||
if (d && *d || l > 255)
|
if (d != c && *d || l > 255)
|
||||||
return 0;
|
return 0;
|
||||||
ia = (ia << 8) | l;
|
ia = (ia << 8) | l;
|
||||||
|
if (c)
|
||||||
|
c++;
|
||||||
a = c;
|
a = c;
|
||||||
}
|
}
|
||||||
*o = ipa_from_u32(ia);
|
*o = ipa_from_u32(ia);
|
||||||
|
|
Loading…
Reference in a new issue