mirror of
https://github.com/yuzu-emu/mbedtls
synced 2024-11-24 14:38:39 +00:00
pk_parse*keyfile: explicitly validate path=NULL
Don't rely on the check in pk_load_file, that's fragile.
This commit is contained in:
parent
d54b97503b
commit
8c71b3ecb3
1 changed files with 2 additions and 0 deletions
|
@ -135,6 +135,7 @@ int mbedtls_pk_parse_keyfile( mbedtls_pk_context *ctx,
|
||||||
unsigned char *buf;
|
unsigned char *buf;
|
||||||
|
|
||||||
PK_VALIDATE_RET( ctx != NULL );
|
PK_VALIDATE_RET( ctx != NULL );
|
||||||
|
PK_VALIDATE_RET( path != NULL );
|
||||||
|
|
||||||
if( ( ret = mbedtls_pk_load_file( path, &buf, &n ) ) != 0 )
|
if( ( ret = mbedtls_pk_load_file( path, &buf, &n ) ) != 0 )
|
||||||
return( ret );
|
return( ret );
|
||||||
|
@ -161,6 +162,7 @@ int mbedtls_pk_parse_public_keyfile( mbedtls_pk_context *ctx, const char *path )
|
||||||
unsigned char *buf;
|
unsigned char *buf;
|
||||||
|
|
||||||
PK_VALIDATE_RET( ctx != NULL );
|
PK_VALIDATE_RET( ctx != NULL );
|
||||||
|
PK_VALIDATE_RET( path != NULL );
|
||||||
|
|
||||||
if( ( ret = mbedtls_pk_load_file( path, &buf, &n ) ) != 0 )
|
if( ( ret = mbedtls_pk_load_file( path, &buf, &n ) ) != 0 )
|
||||||
return( ret );
|
return( ret );
|
||||||
|
|
Loading…
Reference in a new issue