Skip to content

Commit

Permalink
HPCC-32430 Fix warnings in libbase58
Browse files Browse the repository at this point in the history
Signed-off-by: Richard Chapman <[email protected]>
  • Loading branch information
richardkchapman committed Sep 4, 2024
1 parent b0ab434 commit d0044c4
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions system/libbase58/base58.c
Original file line number Diff line number Diff line change
Expand Up @@ -137,9 +137,9 @@ int b58check(const void *bin, size_t binsz, const char *base58str, size_t b58sz)
return -1;

// Check number of zeros is correct AFTER verifying checksum (to avoid possibility of accessing base58str beyond the end)
for (i = 0; binc[i] == '\0' && base58str[i] == '1'; ++i)
for (i = 0; i < binsz && binc[i] == '\0' && i < b58sz && base58str[i] == '1'; ++i)
{} // Just finding the end of zeros, nothing to do in loop
if (binc[i] == '\0' || base58str[i] == '1')
if (i >= binsz || binc[i] == '\0' || i >= b58sz || base58str[i] == '1')
return -3;

return binc[0];
Expand Down

0 comments on commit d0044c4

Please sign in to comment.