some websites append a newline character to a DER-encoded binary blob

This commit is contained in:
Andreas Steffen 2008-02-05 19:27:05 +00:00
parent 5bbac9ffff
commit 298c9c8eed
2 changed files with 30 additions and 10 deletions

View File

@ -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;
}
/**

View File

@ -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;
}