Skip to content

Commit

Permalink
Fix parse_uint64 to handle true UINTMAX_MAX correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
matwey committed Jun 11, 2024
1 parent eba763f commit 2b66ef5
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src/range.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ char* parse_uint64(const char* value, uint64_t* x) {
uintmax_t tmpint;
char* endptr;

errno = 0; // clear errno to distinguish the overflow and true UINTMAX_MAX
tmpint = strtoumax(value, &endptr, 10);
if(tmpint == 0 && endptr == value) // nothing found to convert
return NULL;
Expand Down

0 comments on commit 2b66ef5

Please sign in to comment.