mirror of
https://github.com/ceph/ceph
synced 2024-12-18 01:16:55 +00:00
msg: fix buffer overflow in ipv6 addr parsing
Noticed because of failing i386 unit tests for long addrs; x86_64 passed fine. Sigh. FTR, the failing address was 2001:0db8:85a3:0000:0000:8a2e:0370:7334 Sadly the full length addrs don't turn it up on x86_64, still, nor does valgrind notice. But, this fixes it on i386. Signed-off-by: Sage Weil <sage@inktank.com>
This commit is contained in:
parent
f8a196fb7d
commit
5efaa8d779
@ -69,7 +69,7 @@ bool entity_addr_t::parse(const char *s, const char **end)
|
||||
}
|
||||
*o = 0;
|
||||
|
||||
char buf6[39];
|
||||
char buf6[64]; // actually 39 + null is sufficient.
|
||||
o = buf6;
|
||||
p = start;
|
||||
while (o < buf6 + sizeof(buf6) &&
|
||||
|
@ -32,6 +32,7 @@ const char *addr_checks[][3] = {
|
||||
{ "[2607:f298:4:2243::5522]a", "[2607:f298:4:2243::5522]:0/0", "a" },
|
||||
{ "[2607:f298:4:2243::5522]:1234a", "[2607:f298:4:2243::5522]:1234/0", "a" },
|
||||
{ "2001:0db8:85a3:0000:0000:8a2e:0370:7334", "[2001:db8:85a3::8a2e:370:7334]:0/0", "" },
|
||||
{ "2001:2db8:85a3:4334:4324:8a2e:1370:7334", "[2001:2db8:85a3:4334:4324:8a2e:1370:7334]:0/0", "" },
|
||||
{ "::", "[::]:0/0", "" },
|
||||
{ "::zz", "[::]:0/0", "zz" },
|
||||
{ ":: 12:34", "[::]:0/0", " 12:34" },
|
||||
|
Loading…
Reference in New Issue
Block a user