Add return for buffer too small when reading OIDs

Signed-off-by: Agathiyan Bragadeesh <agathiyan.bragadeesh2@arm.com>
This commit is contained in:
Agathiyan Bragadeesh 2023-08-22 16:42:27 +01:00
parent f3b9724dcd
commit 8aa74ab6a9

View File

@ -865,7 +865,10 @@ int mbedtls_x509_dn_gets(char *buf, size_t size, const mbedtls_x509_name *dn)
p += ret; p += ret;
ret = mbedtls_snprintf(p, n, "="); ret = mbedtls_snprintf(p, n, "=");
print_hexstring = 1; print_hexstring = 1;
} else { } else if (ret == MBEDTLS_ERR_OID_BUF_TOO_SMALL) {
return MBEDTLS_ERR_X509_BUFFER_TOO_SMALL;
}
else {
ret = mbedtls_snprintf(p, n, "\?\?="); ret = mbedtls_snprintf(p, n, "\?\?=");
} }
} }