0
0
mirror of https://github.com/nodejs/node.git synced 2024-12-01 16:10:02 +01:00

url: fix -Warray-bounds warning

Avoid out of bounds access to `url_host_value.ipv6` array.

PR-URL: https://github.com/nodejs/node/pull/9751
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
This commit is contained in:
Santiago Gimeno 2016-11-22 14:47:11 +01:00
parent 11b087222b
commit 0ab2182199
No known key found for this signature in database
GPG Key ID: F28C3C8DA33C03BE

View File

@ -472,10 +472,8 @@ namespace url {
uint16_t* piece = &host->value.ipv6[n];
if (compress_pointer == piece) {
*dest += n == 0 ? "::" : ":";
while (*piece == 0 && n < 8) {
n++;
while (*piece == 0 && ++n < 8)
piece = &host->value.ipv6[n];
}
if (n == 8)
break;
}