Fix checks for nul-termination
This commit is contained in:
parent
24083d61a0
commit
0ece0f94f2
5 changed files with 9 additions and 9 deletions
|
@ -505,7 +505,7 @@ int mbedtls_x509_crl_parse( mbedtls_x509_crl *chain, const unsigned char *buf, s
|
|||
mbedtls_pem_init( &pem );
|
||||
|
||||
/* Avoid calling mbedtls_pem_read_buffer() on non-null-terminated string */
|
||||
if( buf[buflen - 1] != '\0' )
|
||||
if( buflen == 0 || buf[buflen - 1] != '\0' )
|
||||
ret = MBEDTLS_ERR_PEM_NO_HEADER_FOOTER_PRESENT;
|
||||
else
|
||||
ret = mbedtls_pem_read_buffer( &pem,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue