From ef83723f479fce6a26d654c791055b8b06afb54b Mon Sep 17 00:00:00 2001 From: Xavier Stouder Date: Tue, 16 May 2023 13:05:43 +0200 Subject: [PATCH] buffer: use size_t instead of uint32_t to avoid segmentation fault Fixes: https://github.com/nodejs/node/issues/46836 --- src/string_bytes.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/string_bytes.cc b/src/string_bytes.cc index c6ebcf89c4058b..0c3ca98eaf2635 100644 --- a/src/string_bytes.cc +++ b/src/string_bytes.cc @@ -631,7 +631,7 @@ size_t StringBytes::hex_encode( "not enough space provided for hex encode"); dlen = slen * 2; - for (uint32_t i = 0, k = 0; k < dlen; i += 1, k += 2) { + for (size_t i = 0, k = 0; k < dlen; i += 1, k += 2) { static const char hex[] = "0123456789abcdef"; uint8_t val = static_cast(src[i]); dst[k + 0] = hex[val >> 4];