From 0ab21821991dfa7d2745cd951509b3ee0181f632 Mon Sep 17 00:00:00 2001 From: Santiago Gimeno Date: Tue, 22 Nov 2016 14:47:11 +0100 Subject: [PATCH] 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 Reviewed-By: Colin Ihrig --- src/node_url.cc | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/node_url.cc b/src/node_url.cc index 001475b04c9f7a..7502461114a7b4 100644 --- a/src/node_url.cc +++ b/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; }