Skip to content

Commit

Permalink
Enhance argument validation for stricter input checks
Browse files Browse the repository at this point in the history
  • Loading branch information
HiGarfield committed Nov 28, 2024
1 parent e879a9b commit 79b9aa2
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/cpulimit.c
Original file line number Diff line number Diff line change
Expand Up @@ -387,6 +387,13 @@ int main(int argc, char *argv[])
do
{
next_option = getopt_long(argc, argv, short_options, long_options, &option_index);
if (strchr("pel", next_option) != NULL && optarg[0] == '-')
{
fprintf(stderr, "%s: option '%c' requires an argument.\n",
argv[0], next_option);
print_usage_and_exit(stderr, 1);
}

switch (next_option)
{
case 'p':
Expand Down

0 comments on commit 79b9aa2

Please sign in to comment.