Skip to content

Commit

Permalink
utils: fix integer overflow (#3206)
Browse files Browse the repository at this point in the history
Signed-off-by: davkor <[email protected]>
  • Loading branch information
DavidKorczynski authored Mar 10, 2021
1 parent b66339b commit 878c29c
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/flb_utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -453,6 +453,10 @@ int64_t flb_utils_hex2int(char *hex, int len)
char c;

while ((c = *hex++) && i < len) {
/* Ensure no overflow */
if (res >= 0xccccccccccccd00) {
return -1;
}
res *= 0x10;

if (c >= 'a' && c <= 'f') {
Expand Down

0 comments on commit 878c29c

Please sign in to comment.