Skip to content

Commit

Permalink
buffer: use size_t instead of uint32_t to avoid segmentation fault
Browse files Browse the repository at this point in the history
Fixes: #46836
  • Loading branch information
Xstoudi committed May 16, 2023
1 parent 32691bd commit 73805bb
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/string_bytes.cc
Original file line number Diff line number Diff line change
Expand Up @@ -528,7 +528,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<uint8_t>(src[i]);
dst[k + 0] = hex[val >> 4];
Expand Down

0 comments on commit 73805bb

Please sign in to comment.