From 8427233fe0d8bb6292f381e28998e1786668b15f Mon Sep 17 00:00:00 2001 From: Manolis Savva Date: Sun, 4 Oct 2015 20:47:01 -0700 Subject: [PATCH] Fix url hostname matching zero length urls --- lib/url.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/url.js b/lib/url.js index 45155fee936bbf..3628f1dcfb9737 100644 --- a/lib/url.js +++ b/lib/url.js @@ -50,8 +50,8 @@ const autoEscape = ['\''].concat(unwise); const nonHostChars = ['%', '/', '?', ';', '#'].concat(autoEscape); const hostEndingChars = ['/', '?', '#']; const hostnameMaxLen = 255; -const hostnamePartPattern = /^[+a-z0-9A-Z_-]{0,63}$/; -const hostnamePartStart = /^([+a-z0-9A-Z_-]{0,63})(.*)$/; +const hostnamePartPattern = /^[+a-z0-9A-Z_-]{1,63}$/; +const hostnamePartStart = /^([+a-z0-9A-Z_-]{1,63})(.*)$/; // protocols that can allow "unsafe" and "unwise" chars. const unsafeProtocol = { 'javascript': true,