Ensure we don't crash if domain is not a string

Fixes #219
This commit is contained in:
Johannes Zellner
2017-02-13 13:21:23 +01:00
parent b4717e2edb
commit 4217db9e18
+1
View File
@@ -279,6 +279,7 @@ function validateCertificate(cert, key, fqdn) {
if (content.notAfter < new Date()) return new Error('cert expired');
function matchesDomain(domain) {
if (typeof domain !== 'string') return false;
if (domain === fqdn) return true;
if (domain.indexOf('*') === 0 && domain.slice(2) === fqdn.slice(fqdn.indexOf('.') + 1)) return true;