some websites append a newline character to a DER-encoded binary blob
This commit is contained in:
@@ -677,13 +677,23 @@ bool is_asn1(chunk_t blob)
|
|||||||
DBG2(" file content is not binary ASN.1");
|
DBG2(" file content is not binary ASN.1");
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
len = asn1_length(&blob);
|
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 TRUE;
|
||||||
return FALSE;
|
|
||||||
}
|
}
|
||||||
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;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
+16
-6
@@ -758,13 +758,23 @@ is_asn1(chunk_t blob)
|
|||||||
)
|
)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
len = asn1_length(&blob);
|
len = asn1_length(&blob);
|
||||||
if (len != blob.len)
|
|
||||||
|
/* exact match */
|
||||||
|
if (len == blob.len)
|
||||||
{
|
{
|
||||||
DBG(DBG_PARSING,
|
return TRUE;
|
||||||
DBG_log(" file size does not match ASN.1 coded length");
|
|
||||||
)
|
|
||||||
return FALSE;
|
|
||||||
}
|
}
|
||||||
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;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user