Skip to content

Commit

Permalink
#52 Buffer no longer performs length check for hex strings in node v8.x
Browse files Browse the repository at this point in the history
Reviewed by: Alex Wilson <[email protected]>
Approved by: Alex Wilson <[email protected]>
  • Loading branch information
melloc committed Oct 10, 2018
1 parent 6ec6f9d commit 1088992
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/fingerprint.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ Fingerprint.parse = function (fp, options) {
parts = parts.join('');
/*JSSTYLED*/
var md5RE = /^[a-fA-F0-9]+$/;
if (!md5RE.test(parts))
if (!md5RE.test(parts) || md5RE.length % 2 !== 0)
throw (new FingerprintFormatError(fp));
try {
hash = Buffer.from(parts, 'hex');
Expand Down
7 changes: 6 additions & 1 deletion test/openssl-cmd.js
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,12 @@ function genTests() {
var bufs = [];
kid.stdout.on('data', bufs.push.bind(bufs));
kid.on('close', function (rc) {
t.equal(rc, 0);
t.equal(rc, 0, 'openssl exited 0');
if (bufs.length === 0) {
t.fail('"openssl dgst" wrote no output');
t.end();
return;
}
var output = Buffer.concat(bufs);
var sig = sshpk.parseSignature(output, algo, 'asn1');
t.ok(sig);
Expand Down

0 comments on commit 1088992

Please sign in to comment.