Merge 557d0a24ff973c73866df9cd494fca0f13d1d02c into 3bb373867917b674265067cbd38b9d252c43d014

This commit is contained in:
Deomid Ryabkov 2026-07-20 21:05:54 +01:00 committed by GitHub
commit b9c929542b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -253,7 +253,7 @@ void mbedtls_debug_print_crt(const mbedtls_ssl_context *ssl, int level,
const char *file, int line,
const char *text, const mbedtls_x509_crt *crt)
{
char str[DEBUG_BUF_SIZE];
char *buf = NULL;
int i = 0;
if (NULL == ssl ||
@ -264,13 +264,15 @@ void mbedtls_debug_print_crt(const mbedtls_ssl_context *ssl, int level,
return;
}
buf = mbedtls_calloc(1, 1024);
if (buf == NULL) {
return;
}
while (crt != NULL) {
char buf[1024];
mbedtls_snprintf(buf, 1023, "%s #%d:\n", text, ++i);
debug_send_line(ssl, level, file, line, buf);
mbedtls_snprintf(str, sizeof(str), "%s #%d:\n", text, ++i);
debug_send_line(ssl, level, file, line, str);
mbedtls_x509_crt_info(buf, sizeof(buf) - 1, "", crt);
mbedtls_x509_crt_info(buf, 1023, "", crt);
debug_print_line_by_line(ssl, level, file, line, buf);
#if defined(MBEDTLS_PK_WRITE_C)
@ -279,6 +281,7 @@ void mbedtls_debug_print_crt(const mbedtls_ssl_context *ssl, int level,
crt = crt->next;
}
mbedtls_free(buf);
}
#endif /* MBEDTLS_X509_CRT_PARSE_C && MBEDTLS_X509_REMOVE_INFO */