mirror of
https://github.com/zeek/zeek.git
synced 2025-10-07 09:08:20 +00:00
Make buffer for certificate subjects bigger.
Flush buffer between reads (in case we still get something with a longer subject). Addresses BIT-1195
This commit is contained in:
parent
8ec8dfa705
commit
bb09de7828
1 changed files with 3 additions and 1 deletions
|
@ -88,7 +88,7 @@ RecordVal* file_analysis::X509::ParseCertificate(X509Val* cert_val)
|
||||||
{
|
{
|
||||||
::X509* ssl_cert = cert_val->GetCertificate();
|
::X509* ssl_cert = cert_val->GetCertificate();
|
||||||
|
|
||||||
char buf[256]; // we need a buffer for some of the openssl functions
|
char buf[1024]; // we need a buffer for some of the openssl functions
|
||||||
memset(buf, 0, sizeof(buf));
|
memset(buf, 0, sizeof(buf));
|
||||||
|
|
||||||
RecordVal* pX509Cert = new RecordVal(BifType::Record::X509::Certificate);
|
RecordVal* pX509Cert = new RecordVal(BifType::Record::X509::Certificate);
|
||||||
|
@ -98,10 +98,12 @@ RecordVal* file_analysis::X509::ParseCertificate(X509Val* cert_val)
|
||||||
i2a_ASN1_INTEGER(bio, X509_get_serialNumber(ssl_cert));
|
i2a_ASN1_INTEGER(bio, X509_get_serialNumber(ssl_cert));
|
||||||
int len = BIO_read(bio, &(*buf), sizeof(buf));
|
int len = BIO_read(bio, &(*buf), sizeof(buf));
|
||||||
pX509Cert->Assign(1, new StringVal(len, buf));
|
pX509Cert->Assign(1, new StringVal(len, buf));
|
||||||
|
BIO_reset(bio);
|
||||||
|
|
||||||
X509_NAME_print_ex(bio, X509_get_subject_name(ssl_cert), 0, XN_FLAG_RFC2253);
|
X509_NAME_print_ex(bio, X509_get_subject_name(ssl_cert), 0, XN_FLAG_RFC2253);
|
||||||
len = BIO_gets(bio, &(*buf), sizeof(buf));
|
len = BIO_gets(bio, &(*buf), sizeof(buf));
|
||||||
pX509Cert->Assign(2, new StringVal(len, buf));
|
pX509Cert->Assign(2, new StringVal(len, buf));
|
||||||
|
BIO_reset(bio);
|
||||||
X509_NAME_print_ex(bio, X509_get_issuer_name(ssl_cert), 0, XN_FLAG_RFC2253);
|
X509_NAME_print_ex(bio, X509_get_issuer_name(ssl_cert), 0, XN_FLAG_RFC2253);
|
||||||
len = BIO_gets(bio, &(*buf), sizeof(buf));
|
len = BIO_gets(bio, &(*buf), sizeof(buf));
|
||||||
pX509Cert->Assign(3, new StringVal(len, buf));
|
pX509Cert->Assign(3, new StringVal(len, buf));
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue