diff options
-rw-r--r-- | install/ui/net.js | 5 | ||||
-rw-r--r-- | install/ui/test/ip_tests.js | 3 |
2 files changed, 8 insertions, 0 deletions
diff --git a/install/ui/net.js b/install/ui/net.js index 6b4b20cf..9eba6dc7 100644 --- a/install/ui/net.js +++ b/install/ui/net.js @@ -125,6 +125,11 @@ NET.ip_address = function(spec) { var i; + //usecases like ':' + if (that.parts.length <= 2) { + return that.set_error('invalid format'); + } + for (i=0; i<that.parts.length; i++) { var part = that.parts[i]; diff --git a/install/ui/test/ip_tests.js b/install/ui/test/ip_tests.js index 8bac3a6a..74fe7c2b 100644 --- a/install/ui/test/ip_tests.js +++ b/install/ui/test/ip_tests.js @@ -156,6 +156,9 @@ test('Testing incorrect IPv6 addresses', function() { address = NET.ip_address('2001:db8:85a3:0:0:8a2e:370'); ok(!address.valid, 'Missing part - 2001:db8:85a3:0:0:8a2e:370'); + address = NET.ip_address(':'); + ok(!address.valid, 'Address - :'); + address = NET.ip_address('::1::'); ok(!address.valid, 'Address - ::1::'); |