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
  • Loading branch information
Xstoudi authored and aduh95 committed May 11, 2024
1 parent 491855c commit ef83723
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 @@ -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<uint8_t>(src[i]);
dst[k + 0] = hex[val >> 4];
Expand Down

0 comments on commit ef83723

Please sign in to comment.