From 24d9c455999c4d0786482afe95b6527af6b87d04 Mon Sep 17 00:00:00 2001 From: Chris Manson Date: Wed, 26 Aug 2015 13:02:55 +0100 Subject: [PATCH] Adding an extra check for cert.subject before assuming it is there. --- lib/tls.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/tls.js b/lib/tls.js index 0d85a948dcc511..988864ed339cf6 100644 --- a/lib/tls.js +++ b/lib/tls.js @@ -177,10 +177,12 @@ exports.checkServerIdentity = function checkServerIdentity(host, cert) { reason = util.format('Host: %s is not in the cert\'s altnames: %s', host, cert.subjectaltname); - } else { + } else if (cert.subject) { reason = util.format('Host: %s is not cert\'s CN: %s', host, cert.subject.CN); + } else { + reason = util.format('Host: %s cert\'s subject is missing', host); } } } else {