Skip to content

Commit

Permalink
Update goodbyedpi.c
Browse files Browse the repository at this point in the history
  • Loading branch information
SashaXser authored Nov 27, 2023
1 parent e3937e4 commit bcfa72d
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/goodbyedpi.c
Original file line number Diff line number Diff line change
Expand Up @@ -813,15 +813,17 @@ int main(int argc, char *argv[]) {
char *autottl_copy = strdup(optarg);
if (strchr(autottl_copy, '-')) {
// token "-" found, start X-Y parser
char *autottl_current = strtok(autottl_copy, "-");
char *autottl_current;
char *saveptr; // declare a pointer to store the state of strtok_r
autottl_current = strtok_r(autottl_copy, "-", &saveptr); // use strtok_r instead of strtok
auto_ttl_1 = atoub(autottl_current, "Set Auto TTL parameter error!");
autottl_current = strtok(NULL, "-");
autottl_current = strtok_r(NULL, "-", &saveptr); // use strtok_r instead of strtok
if (!autottl_current) {
puts("Set Auto TTL parameter error!");
exit(EXIT_FAILURE);
}
auto_ttl_2 = atoub(autottl_current, "Set Auto TTL parameter error!");
autottl_current = strtok(NULL, "-");
autottl_current = strtok_r(NULL, "-", &saveptr); // use strtok_r instead of strtok
if (!autottl_current) {
puts("Set Auto TTL parameter error!");
exit(EXIT_FAILURE);
Expand Down

0 comments on commit bcfa72d

Please sign in to comment.