Skip to content

Commit 1088992

Browse files
committed
#52 Buffer no longer performs length check for hex strings in node v8.x
Reviewed by: Alex Wilson <alex.wilson@joyent.com> Approved by: Alex Wilson <alex.wilson@joyent.com>
1 parent 6ec6f9d commit 1088992

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

lib/fingerprint.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ Fingerprint.parse = function (fp, options) {
102102
parts = parts.join('');
103103
/*JSSTYLED*/
104104
var md5RE = /^[a-fA-F0-9]+$/;
105-
if (!md5RE.test(parts))
105+
if (!md5RE.test(parts) || md5RE.length % 2 !== 0)
106106
throw (new FingerprintFormatError(fp));
107107
try {
108108
hash = Buffer.from(parts, 'hex');

test/openssl-cmd.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,12 @@ function genTests() {
212212
var bufs = [];
213213
kid.stdout.on('data', bufs.push.bind(bufs));
214214
kid.on('close', function (rc) {
215-
t.equal(rc, 0);
215+
t.equal(rc, 0, 'openssl exited 0');
216+
if (bufs.length === 0) {
217+
t.fail('"openssl dgst" wrote no output');
218+
t.end();
219+
return;
220+
}
216221
var output = Buffer.concat(bufs);
217222
var sig = sshpk.parseSignature(output, algo, 'asn1');
218223
t.ok(sig);

0 commit comments

Comments
 (0)