mirror of
https://github.com/oliverschmidt/contiki.git
synced 2025-01-20 16:32:12 +00:00
Fixed uiplib to stop parsing IPv6 address when at length part
This commit is contained in:
parent
0ea95c21b3
commit
65edc32de2
@ -57,13 +57,13 @@ uiplib_ipaddrconv(const char *addrstr, uip_ipaddr_t *ipaddr)
|
|||||||
|
|
||||||
for(len = 0; len < sizeof(uip_ipaddr_t) - 1; addrstr++) {
|
for(len = 0; len < sizeof(uip_ipaddr_t) - 1; addrstr++) {
|
||||||
c = *addrstr;
|
c = *addrstr;
|
||||||
if(c == ':' || c == '\0' || c == ']') {
|
if(c == ':' || c == '\0' || c == ']' || c == '/') {
|
||||||
ipaddr->u8[len] = (value >> 8) & 0xff;
|
ipaddr->u8[len] = (value >> 8) & 0xff;
|
||||||
ipaddr->u8[len + 1] = value & 0xff;
|
ipaddr->u8[len + 1] = value & 0xff;
|
||||||
len += 2;
|
len += 2;
|
||||||
value = 0;
|
value = 0;
|
||||||
|
|
||||||
if(c == '\0' || c == ']') {
|
if(c == '\0' || c == ']' || c == '/') {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -88,7 +88,7 @@ uiplib_ipaddrconv(const char *addrstr, uip_ipaddr_t *ipaddr)
|
|||||||
value = (value << 4) + (tmp & 0xf);
|
value = (value << 4) + (tmp & 0xf);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(c != '\0' && c != ']') {
|
if(c != '\0' && c != ']' && c != '/') {
|
||||||
PRINTF("uiplib: too large address\n");
|
PRINTF("uiplib: too large address\n");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user