mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2025-03-01 13:13:28 +00:00
Add catch for alloc error x509_oid_from_numericoid
Signed-off-by: Agathiyan Bragadeesh <agathiyan.bragadeesh2@arm.com>
This commit is contained in:
parent
4294ccc608
commit
fb94702762
@ -146,6 +146,11 @@ static char *x509_oid_from_numericoid(const char *numericoid,
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
oid = mbedtls_calloc(1, oid_buf->len + 1);
|
oid = mbedtls_calloc(1, oid_buf->len + 1);
|
||||||
|
if(oid == NULL) {
|
||||||
|
mbedtls_free(oid_buf->p);
|
||||||
|
mbedtls_free(oid_buf);
|
||||||
|
return MBEDTLS_ERR_X509_ALLOC_FAILED;
|
||||||
|
}
|
||||||
memcpy(oid, oid_buf->p, oid_buf->len);
|
memcpy(oid, oid_buf->p, oid_buf->len);
|
||||||
oid[oid_buf->len + 1] = '\0';
|
oid[oid_buf->len + 1] = '\0';
|
||||||
mbedtls_free(oid_buf->p);
|
mbedtls_free(oid_buf->p);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user