david/ipxe
david
/
ipxe
Archived
1
0
Fork 0

[crypto] Check that common name contains no NUL characters

Signed-off-by: Michael Brown <mcb30@ipxe.org>
This commit is contained in:
Michael Brown 2012-05-08 10:38:04 +01:00
parent 0ad8b601dd
commit 6c8fcd4bb3
1 changed files with 9 additions and 0 deletions

View File

@ -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;
}