mirror of
https://github.com/espressif/mbedtls.git
synced 2026-08-24 04:09:52 +00:00
pkcs7: check that content lengths fill whole buffer
Otherwise invalid data could be accepted. Signed-off-by: Demi Marie Obenour <[email protected]> Signed-off-by: Dave Rodgman <[email protected]>
This commit is contained in:
committed by
Dave Rodgman
parent
a22749e749
commit
512818b1d2
@@ -58,6 +58,9 @@ static int pkcs7_get_next_content_len(unsigned char **p, unsigned char *end,
|
||||
| MBEDTLS_ASN1_CONTEXT_SPECIFIC);
|
||||
if (ret != 0) {
|
||||
ret = MBEDTLS_ERROR_ADD(MBEDTLS_ERR_PKCS7_INVALID_FORMAT, ret);
|
||||
} else if ((size_t) (end - *p) != *len) {
|
||||
ret = MBEDTLS_ERROR_ADD(MBEDTLS_ERR_PKCS7_INVALID_FORMAT,
|
||||
MBEDTLS_ERR_ASN1_LENGTH_MISMATCH);
|
||||
}
|
||||
|
||||
return ret;
|
||||
|
||||
Reference in New Issue
Block a user