Skip to content

Commit

Permalink
Merge pull request hpcc-systems#18990 from richardkchapman/HPCC-32430
Browse files Browse the repository at this point in the history
HPCC-32430 Fix warnings in libbase58

Reviewed-by: Gavin Halliday <[email protected]>
Merged-by: Gavin Halliday <[email protected]>
  • Loading branch information
ghalliday authored Sep 4, 2024
2 parents dc89635 + d0044c4 commit 50293b1
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 50293b1

Please sign in to comment.