--- a/src/opensslfingerprint.cxx
+++ b/src/opensslfingerprint.cxx
@@ -110,7 +110,9 @@ std::string getCertFingerprint(const std
 	snprintf(&fpbuf[57], 3, "%02x", md[19]);
 
 	if (Debug) {
-		syslog (LOG_DEBUG, "Cert: %s, fingerprint: %s", x->name, fpbuf);
+		char *namebuf = X509_NAME_oneline(X509_get_subject_name(x),NULL,0);
+		syslog (LOG_DEBUG, "Cert: %s, fingerprint: %s", namebuf, fpbuf);
+		free(namebuf);
 	}
 
 	std::string fp = fpbuf;