mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2026-04-03 02:56:55 +02:00
Merge pull request #1487 from davidhorstmann-arm/fix-null-pointer-dereference
Fix null pointer dereference in `mbedtls_x509_string_to_names()`
This commit is contained in:
4
ChangeLog.d/fix-null-pointer-dereference.txt
Normal file
4
ChangeLog.d/fix-null-pointer-dereference.txt
Normal file
@@ -0,0 +1,4 @@
|
||||
Security
|
||||
* Fix a NULL pointer dereference in mbedtls_x509_string_to_names() when
|
||||
mbedtls_calloc() fails to allocate memory. This was caused by failing to
|
||||
check whether mbedtls_calloc() returned NULL.
|
||||
@@ -487,6 +487,9 @@ int mbedtls_x509_string_to_names(mbedtls_asn1_named_data **head, const char *nam
|
||||
} else {
|
||||
oid.len = strlen(attr_descr->oid);
|
||||
oid.p = mbedtls_calloc(1, oid.len);
|
||||
if (oid.p == NULL) {
|
||||
return MBEDTLS_ERR_X509_ALLOC_FAILED;
|
||||
}
|
||||
memcpy(oid.p, attr_descr->oid, oid.len);
|
||||
numericoid = 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user