mirror of
https://github.com/Waujito/youtubeUnblock.git
synced 2024-12-22 06:15:31 +00:00
Fix segfault on unrecognized option
This commit is contained in:
parent
6bbeae3876
commit
8e592d8957
@ -65,6 +65,11 @@ struct config_t config = {
|
||||
static long parse_numeric_option(const char* value) {
|
||||
errno = 0;
|
||||
|
||||
if (*value == '\0') {
|
||||
errno = EINVAL;
|
||||
return 0;
|
||||
}
|
||||
|
||||
char* end;
|
||||
long result = strtol(value, &end, 10);
|
||||
if (*end != '\0') {
|
||||
@ -208,7 +213,6 @@ static int parse_args(int argc, char *argv[]) {
|
||||
config.fake_sni_ttl = num;
|
||||
break;
|
||||
default:
|
||||
printf("Invalid option %s\n", long_opt[optIdx].name);
|
||||
goto error;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user