Commit 708ed766 authored by Jean-Paul Saman's avatar Jean-Paul Saman

dvbinfo: check optarg

parent 9ee8155e
...@@ -609,13 +609,16 @@ int main(int argc, char **pp_argv) ...@@ -609,13 +609,16 @@ int main(int argc, char **pp_argv)
/* - tuning options - */ /* - tuning options - */
case 'c': case 'c':
param->threshold = strtoul(optarg, NULL, 10); if (optarg)
if (((errno == ERANGE) && (param->threshold == ULONG_MAX)) ||
((errno != 0) && (param->threshold == 0)))
{ {
fprintf(stderr, "Option --capturesize has invalid content %s\n", optarg); param->threshold = strtoul(optarg, NULL, 10);
params_free(param); if (((errno == ERANGE) && (param->threshold == ULONG_MAX)) ||
usage(); ((errno != 0) && (param->threshold == 0)))
{
fprintf(stderr, "Option --capturesize has invalid content %s\n", optarg);
params_free(param);
usage();
}
} }
break; break;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment