Skip to content

Commit

Permalink
clear errno before strtoull
Browse files Browse the repository at this point in the history
I ran into a bug on ARM where we were getting non-zero here, from
something else that stuck around in error.
  • Loading branch information
oconnor663 committed Jan 28, 2020
1 parent 4304cd1 commit d7a37fa
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions c/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ int main(int argc, char **argv) {
}
if (strcmp("--length", argv[1]) == 0) {
char *endptr = NULL;
errno = 0;
unsigned long long out_len_ll = strtoull(argv[2], &endptr, 10);
if (errno != 0 || out_len > SIZE_MAX || endptr == argv[2] ||
*endptr != 0) {
Expand Down

0 comments on commit d7a37fa

Please sign in to comment.