luci-base: cbi.js: fix corner case in IPv6() address parser
The implementation allowed a hexadecimal string without any colons. Signed-off-by: Jo-Philipp Wich <jo@mein.io>
This commit is contained in:
parent
7f613be500
commit
51fb04f6e0
1 changed files with 2 additions and 1 deletions
|
@ -106,7 +106,8 @@ function IPv6(x) {
|
|||
var prefix = (prefix_suffix[0] || '0').split(/:/);
|
||||
var suffix = prefix_suffix.length > 1 ? (prefix_suffix[1] || '0').split(/:/) : [];
|
||||
|
||||
if (suffix.length ? (prefix.length + suffix.length > 7) : (prefix.length > 8))
|
||||
if (suffix.length ? (prefix.length + suffix.length > 7)
|
||||
: ((prefix_suffix.length < 2 && prefix.length < 8) || prefix.length > 8))
|
||||
return null;
|
||||
|
||||
var i, word;
|
||||
|
|
Loading…
Reference in a new issue