mirror of
https://github.com/xcat2/xNBA.git
synced 2025-02-06 22:11:57 +00:00
[crypto] Check that common name contains no NUL characters
Signed-off-by: Michael Brown <mcb30@ipxe.org>
This commit is contained in:
parent
0ad8b601dd
commit
6c8fcd4bb3
@ -575,6 +575,15 @@ static int x509_parse_common_name ( struct x509_certificate *cert, char **name,
|
||||
if ( ! *name )
|
||||
return -ENOMEM;
|
||||
memcpy ( *name, name_cursor.data, name_cursor.len );
|
||||
|
||||
/* Check that name contains no NULs */
|
||||
if ( strlen ( *name ) != name_cursor.len ) {
|
||||
DBGC ( cert, "X509 %p contains malicious commonName:\n",
|
||||
cert );
|
||||
DBGC_HDA ( cert, 0, raw->data, raw->len );
|
||||
return rc;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user