diff --git a/gget.c b/gget.c index 43ce4ca..49fab52 100644 --- a/gget.c +++ b/gget.c @@ -515,7 +515,12 @@ int main(int argc, char** argv) while ((opt = getopt(argc, argv, "hn:l:o:u:qm:")) != -1) { switch (opt) { case 'n': - nb_threads = atoi(optarg); + nb_threads = strtoul(optarg, &endptr, 0); + if (*endptr) + { + usage(argv[0]); + return 1; + } if (nb_threads == 0) nb_threads = DEFAULT_NB_THREADS; else if (nb_threads > MAX_NB_THREADS) @@ -525,7 +530,12 @@ int main(int argc, char** argv) } break; case 'l': - max_speed = atoi(optarg); + max_speed = strtoul(optarg, &endptr, 0); + if (*endptr) + { + usage(argv[0]); + return 1; + } break; case 'm': if (strlen(optarg) > 1)