From bcde9d59a7b9ab9ae8db8cc8430c5a7a8cc3700e Mon Sep 17 00:00:00 2001 From: Christopher Jeffrey Date: Mon, 16 Jan 2017 14:42:36 -0800 Subject: [PATCH] ip: handle ipv4-mapped ipv6 addr missing sections properly. --- lib/utils/ip.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lib/utils/ip.js b/lib/utils/ip.js index f39915ee..a7ad24a1 100644 --- a/lib/utils/ip.js +++ b/lib/utils/ip.js @@ -280,6 +280,14 @@ IP.parseV6 = function parseV6(str, buf, offset) { assert(missing >= 0, 'IPv6 address is too long.'); assert(parts.length >= 2, 'Not an IPv6 address.'); + for (i = 0; i < parts.length; i++) { + word = parts[i]; + if (IP.isV4Format(word)) + missing--; + } + + assert(missing >= 0, 'IPv6 address is too long.'); + for (i = 0; i < parts.length; i++) { word = parts[i];