mirror of
https://github.com/lwip-tcpip/lwip.git
synced 2025-01-06 18:54:18 +00:00
changes to ip6addr_aton() to avoid crash with some ill-formatted
strings.
This commit is contained in:
parent
2c79332de7
commit
73660f779b
@ -104,10 +104,12 @@ ip6addr_aton(const char *cp, ip6_addr_t *addr)
|
|||||||
if (current_block_index > 7) {
|
if (current_block_index > 7) {
|
||||||
/* address too long! */
|
/* address too long! */
|
||||||
return 0;
|
return 0;
|
||||||
} if (s[1] == ':') {
|
}
|
||||||
|
if (s[1] == ':') {
|
||||||
s++;
|
s++;
|
||||||
/* "::" found, set zeros */
|
/* "::" found, set zeros */
|
||||||
while (zero_blocks-- > 0) {
|
while (zero_blocks > 0) {
|
||||||
|
zero_blocks--;
|
||||||
if (current_block_index & 0x1) {
|
if (current_block_index & 0x1) {
|
||||||
addr_index++;
|
addr_index++;
|
||||||
}
|
}
|
||||||
@ -117,6 +119,10 @@ ip6addr_aton(const char *cp, ip6_addr_t *addr)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
current_block_index++;
|
current_block_index++;
|
||||||
|
if (current_block_index > 7) {
|
||||||
|
/* address too long! */
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (isxdigit(*s)) {
|
} else if (isxdigit(*s)) {
|
||||||
|
Loading…
Reference in New Issue
Block a user