Fixed uiplib to stop parsing IPv6 address when at length part
This commit is contained in:
parent
0ea95c21b3
commit
65edc32de2
1 changed files with 3 additions and 3 deletions
|
@ -57,13 +57,13 @@ uiplib_ipaddrconv(const char *addrstr, uip_ipaddr_t *ipaddr)
|
|||
|
||||
for(len = 0; len < sizeof(uip_ipaddr_t) - 1; addrstr++) {
|
||||
c = *addrstr;
|
||||
if(c == ':' || c == '\0' || c == ']') {
|
||||
if(c == ':' || c == '\0' || c == ']' || c == '/') {
|
||||
ipaddr->u8[len] = (value >> 8) & 0xff;
|
||||
ipaddr->u8[len + 1] = value & 0xff;
|
||||
len += 2;
|
||||
value = 0;
|
||||
|
||||
if(c == '\0' || c == ']') {
|
||||
if(c == '\0' || c == ']' || c == '/') {
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -88,7 +88,7 @@ uiplib_ipaddrconv(const char *addrstr, uip_ipaddr_t *ipaddr)
|
|||
value = (value << 4) + (tmp & 0xf);
|
||||
}
|
||||
}
|
||||
if(c != '\0' && c != ']') {
|
||||
if(c != '\0' && c != ']' && c != '/') {
|
||||
PRINTF("uiplib: too large address\n");
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue