|
@@ -575,6 +575,15 @@ static int x509_parse_common_name ( struct x509_certificate *cert, char **name,
|
575
|
575
|
if ( ! *name )
|
576
|
576
|
return -ENOMEM;
|
577
|
577
|
memcpy ( *name, name_cursor.data, name_cursor.len );
|
|
578
|
+
|
|
579
|
+ /* Check that name contains no NULs */
|
|
580
|
+ if ( strlen ( *name ) != name_cursor.len ) {
|
|
581
|
+ DBGC ( cert, "X509 %p contains malicious commonName:\n",
|
|
582
|
+ cert );
|
|
583
|
+ DBGC_HDA ( cert, 0, raw->data, raw->len );
|
|
584
|
+ return rc;
|
|
585
|
+ }
|
|
586
|
+
|
578
|
587
|
return 0;
|
579
|
588
|
}
|
580
|
589
|
|