This commit is contained in:
Christopher Jeffrey 2016-05-25 14:10:55 -07:00
parent 284bba746a
commit e59feaf695
No known key found for this signature in database
GPG Key ID: 8962AB9DE6666BBD
2 changed files with 8 additions and 7 deletions

View File

@ -208,10 +208,7 @@ ec.privateKeyVerify = function privateKeyVerify(key) {
key = new bn(key);
if (key.cmpn(0) === 0 || key.cmp(ec.elliptic.curve.n) >= 0)
return false;
return true;
return key.cmpn(0) !== 0 && key.cmp(ec.elliptic.curve.n) < 0;
};
/**

View File

@ -858,12 +858,15 @@ utils.parseHost = function parseHost(addr) {
if (typeof addr === 'object')
return addr;
if (addr.indexOf(']') !== -1)
if (addr[0] === '[') {
addr = addr.substring(1);
parts = addr.split(/\]:?/);
else
assert(parts.length === 2);
} else {
parts = addr.split(':');
}
host = parts[0].replace(/[\[\]]/g, '');
host = parts[0];
port = +parts[1] || 0;
if (utils.ip.version(host) !== -1)
@ -915,6 +918,7 @@ utils.ip.version = function version(ip) {
/**
* Test whether a buffer is an ipv4-mapped ipv6 address.
* @param {Buffer} ip
* @returns {Boolean}
*/