goto info_done_dealloc;
}
- gnutls_x509_crt_get_dn(cert, name, &name_size);
- certinfo->dn = name;
+ if (gnutls_x509_crt_get_dn(cert, name, &name_size) == 0)
+ {
+ std::string& dn = certinfo->dn;
+ dn = name;
+ // Make sure there are no chars in the string that we consider invalid
+ if (dn.find_first_of("\r\n") != std::string::npos)
+ dn.clear();
+ }
- gnutls_x509_crt_get_issuer_dn(cert, name, &name_size);
- certinfo->issuer = name;
+ name_size = sizeof(name);
+ if (gnutls_x509_crt_get_issuer_dn(cert, name, &name_size) == 0)
+ {
+ std::string& issuer = certinfo->issuer;
+ issuer = name;
+ if (issuer.find_first_of("\r\n") != std::string::npos)
+ issuer.clear();
+ }
if ((ret = gnutls_x509_crt_get_fingerprint(cert, hash, digest, &digest_size)) < 0)
{
char buf[512];
X509_NAME_oneline(X509_get_subject_name(cert), buf, sizeof(buf));
certinfo->dn = buf;
+ // Make sure there are no chars in the string that we consider invalid
+ if (certinfo->dn.find_first_of("\r\n") != std::string::npos)
+ certinfo->dn.clear();
+
X509_NAME_oneline(X509_get_issuer_name(cert), buf, sizeof(buf));
certinfo->issuer = buf;
+ if (certinfo->issuer.find_first_of("\r\n") != std::string::npos)
+ certinfo->issuer.clear();
if (!X509_digest(cert, digest, md, &n))
{