mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2025-04-07 13:22:46 +00:00
Merge pull request #7849 from davidhorstmann-arm/fix-string-to-names-retcode
Fix false success return code in `mbedtls_x509_string_to_names()`
This commit is contained in:
commit
c4a760c538
3
ChangeLog.d/fix-string-to-names-retcode.txt
Normal file
3
ChangeLog.d/fix-string-to-names-retcode.txt
Normal file
@ -0,0 +1,3 @@
|
||||
Bugfix
|
||||
* Fix a bug in which mbedtls_x509_string_to_names() would return success
|
||||
when given a invalid name string if it did not contain '=' or ','.
|
@ -125,7 +125,7 @@ static const x509_attr_descriptor_t *x509_attr_descr_from_name(const char *name,
|
||||
|
||||
int mbedtls_x509_string_to_names(mbedtls_asn1_named_data **head, const char *name)
|
||||
{
|
||||
int ret = 0;
|
||||
int ret = MBEDTLS_ERR_X509_INVALID_NAME;
|
||||
const char *s = name, *c = s;
|
||||
const char *end = s + strlen(s);
|
||||
const char *oid = NULL;
|
||||
@ -177,6 +177,9 @@ int mbedtls_x509_string_to_names(mbedtls_asn1_named_data **head, const char *nam
|
||||
|
||||
s = c + 1;
|
||||
in_tag = 1;
|
||||
|
||||
/* Successfully parsed one name, update ret to success */
|
||||
ret = 0;
|
||||
}
|
||||
|
||||
if (!in_tag && s != c + 1) {
|
||||
|
@ -184,5 +184,8 @@ mbedtls_x509_string_to_names:"C=NL, O=Offspark\\a Inc., OU=PolarSSL":"":MBEDTLS_
|
||||
X509 String to Names #6 (Escape at end)
|
||||
mbedtls_x509_string_to_names:"C=NL, O=Offspark\\":"":MBEDTLS_ERR_X509_INVALID_NAME
|
||||
|
||||
X509 String to Names #6 (Invalid, no '=' or ',')
|
||||
mbedtls_x509_string_to_names:"ABC123":"":MBEDTLS_ERR_X509_INVALID_NAME
|
||||
|
||||
Check max serial length
|
||||
x509_set_serial_check:
|
||||
|
Loading…
x
Reference in New Issue
Block a user