pkcs7: pkcs7_get_content_info_type should reset *p on error
The function `pkcs7_asn1_get_tag` should return an update pointer only on success. Currently, the pointer is being updated on a failure case. This commit resets *p to start if the first call to mbedtls_asn1_get_tag fails. Signed-off-by: Daniel Axtens <dja@axtens.net> Signed-off-by: Nick Child <nick.child@ibm.com>
This commit is contained in:
parent
136c6aa467
commit
c448c94fe3
1 changed files with 3 additions and 1 deletions
|
@ -107,8 +107,10 @@ static int pkcs7_get_content_info_type( unsigned char **p, unsigned char *end,
|
|||
|
||||
ret = mbedtls_asn1_get_tag( p, end, &len, MBEDTLS_ASN1_CONSTRUCTED
|
||||
| MBEDTLS_ASN1_SEQUENCE );
|
||||
if( ret != 0 )
|
||||
if( ret != 0 ) {
|
||||
*p = start;
|
||||
return( MBEDTLS_ERR_PKCS7_INVALID_CONTENT_INFO + ret );
|
||||
}
|
||||
|
||||
ret = mbedtls_asn1_get_tag( p, end, &len, MBEDTLS_ASN1_OID );
|
||||
if( ret != 0 ) {
|
||||
|
|
Loading…
Reference in a new issue