From 746c07372924db6d80e93a5553e7241c670d27d0 Mon Sep 17 00:00:00 2001 From: Bernhard Amann Date: Wed, 14 May 2014 15:53:26 -0700 Subject: [PATCH] Replace errors when parsing x509 certs with weirds (as requested by Seth). The one I did not replace is a malloc issue which I think really should raise an error. --- src/file_analysis/analyzer/x509/X509.cc | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/file_analysis/analyzer/x509/X509.cc b/src/file_analysis/analyzer/x509/X509.cc index 6e0f37e9c9..23cccc6030 100644 --- a/src/file_analysis/analyzer/x509/X509.cc +++ b/src/file_analysis/analyzer/x509/X509.cc @@ -46,7 +46,7 @@ bool file_analysis::X509::EndOfFile() ::X509* ssl_cert = d2i_X509(NULL, &cert_char, cert_data.size()); if ( ! ssl_cert ) { - reporter->Error("Could not parse X509 certificate (fuid %s)", GetFile()->GetID().c_str()); + reporter->Weird(fmt("Could not parse X509 certificate (fuid %s)", GetFile()->GetID().c_str())); return false; } @@ -171,7 +171,7 @@ StringVal* file_analysis::X509::GetExtensionFromBIO(BIO* bio) { char tmp[120]; ERR_error_string_n(ERR_get_error(), tmp, sizeof(tmp)); - reporter->Error("X509::GetExtensionFromBIO: %s", tmp); + reporter->Weird(fmt("X509::GetExtensionFromBIO: %s", tmp)); BIO_free_all(bio); return 0; } @@ -279,7 +279,7 @@ void file_analysis::X509::ParseBasicConstraints(X509_EXTENSION* ex) } else - reporter->Error("Certificate with invalid BasicConstraint. fuid %s", GetFile()->GetID().c_str()); + reporter->Weird(fmt("Certificate with invalid BasicConstraint. fuid %s", GetFile()->GetID().c_str())); } void file_analysis::X509::ParseSAN(X509_EXTENSION* ext) @@ -289,7 +289,7 @@ void file_analysis::X509::ParseSAN(X509_EXTENSION* ext) GENERAL_NAMES *altname = (GENERAL_NAMES*)X509V3_EXT_d2i(ext); if ( ! altname ) { - reporter->Error("Could not parse subject alternative names. fuid %s", GetFile()->GetID().c_str()); + reporter->Weird(fmt("Could not parse subject alternative names. fuid %s", GetFile()->GetID().c_str())); return; } @@ -309,7 +309,7 @@ void file_analysis::X509::ParseSAN(X509_EXTENSION* ext) { if ( ASN1_STRING_type(gen->d.ia5) != V_ASN1_IA5STRING ) { - reporter->Error("DNS-field does not contain an IA5String. fuid %s", GetFile()->GetID().c_str()); + reporter->Weird(fmt("DNS-field does not contain an IA5String. fuid %s", GetFile()->GetID().c_str())); continue; } @@ -356,7 +356,7 @@ void file_analysis::X509::ParseSAN(X509_EXTENSION* ext) else { - reporter->Error("Weird IP address length %d in subject alternative name. fuid %s", gen->d.ip->length, GetFile()->GetID().c_str()); + reporter->Weird(fmt("Weird IP address length %d in subject alternative name. fuid %s", gen->d.ip->length, GetFile()->GetID().c_str())); continue; } }