some websites append a newline character to a DER-encoded binary blob
This commit is contained in:
parent
5bbac9ffff
commit
298c9c8eed
|
@ -677,13 +677,23 @@ bool is_asn1(chunk_t blob)
|
|||
DBG2(" file content is not binary ASN.1");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
len = asn1_length(&blob);
|
||||
if (len != blob.len)
|
||||
|
||||
/* exact match */
|
||||
if (len == blob.len)
|
||||
{
|
||||
DBG2(" file size does not match ASN.1 coded length");
|
||||
return FALSE;
|
||||
return TRUE;
|
||||
}
|
||||
return TRUE;
|
||||
|
||||
/* some websites append a surplus newline character to the blob */
|
||||
if (len + 1 == blob.len && *(blob.ptr + len) == '\n')
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
DBG2(" file size does not match ASN.1 coded length");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -758,13 +758,23 @@ is_asn1(chunk_t blob)
|
|||
)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
len = asn1_length(&blob);
|
||||
if (len != blob.len)
|
||||
|
||||
/* exact match */
|
||||
if (len == blob.len)
|
||||
{
|
||||
DBG(DBG_PARSING,
|
||||
DBG_log(" file size does not match ASN.1 coded length");
|
||||
)
|
||||
return FALSE;
|
||||
return TRUE;
|
||||
}
|
||||
return TRUE;
|
||||
|
||||
/* some websites append a surplus newline character to the blob */
|
||||
if (len + 1 == blob.len && *(blob.ptr + len) == '\n')
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
DBG(DBG_PARSING,
|
||||
DBG_log(" file size does not match ASN.1 coded length");
|
||||
)
|
||||
return FALSE;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue