From 2def6e867d88c4c4f7a1724e676ff80a1fe40439 Mon Sep 17 00:00:00 2001 From: Sergey Lyubka Date: Thu, 9 May 2024 15:48:55 +0100 Subject: [PATCH] Reduce stack usage in mg_tls_hexdump() --- mongoose.c | 3 +-- src/tls_builtin.c | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/mongoose.c b/mongoose.c index 3cf96363..1c20636e 100644 --- a/mongoose.c +++ b/mongoose.c @@ -9501,8 +9501,7 @@ static uint8_t zeros_sha256_digest[32] = { // helper to hexdump buffers inline static void mg_tls_hexdump(const char *msg, uint8_t *buf, size_t bufsz) { - char p[8 * 4096]; - MG_VERBOSE(("%s: %s", msg, mg_hex(buf, bufsz, p))); + MG_VERBOSE(("%s: %M", msg, mg_print_hex, bufsz, buf)); } // helper utilities to parse ASN.1 DER diff --git a/src/tls_builtin.c b/src/tls_builtin.c index cc0e16fd..781fdb9d 100644 --- a/src/tls_builtin.c +++ b/src/tls_builtin.c @@ -127,8 +127,7 @@ static uint8_t zeros_sha256_digest[32] = { // helper to hexdump buffers inline static void mg_tls_hexdump(const char *msg, uint8_t *buf, size_t bufsz) { - char p[8 * 4096]; - MG_VERBOSE(("%s: %s", msg, mg_hex(buf, bufsz, p))); + MG_VERBOSE(("%s: %M", msg, mg_print_hex, bufsz, buf)); } // helper utilities to parse ASN.1 DER