Browse Source

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>
v6
Santiago Gimeno 8 years ago
parent
commit
0ab2182199
No known key found for this signature in database GPG Key ID: F28C3C8DA33C03BE
  1. 4
      src/node_url.cc

4
src/node_url.cc

@ -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;
}

Loading…
Cancel
Save