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)
/* - tuning options - */
case 'c':
param->threshold = strtoul(optarg, NULL, 10);
if (((errno == ERANGE) && (param->threshold == ULONG_MAX)) ||
((errno != 0) && (param->threshold == 0)))
if (optarg)
{
fprintf(stderr, "Option --capturesize has invalid content %s\n", optarg);
params_free(param);
usage();
param->threshold = strtoul(optarg, NULL, 10);
if (((errno == ERANGE) && (param->threshold == ULONG_MAX)) ||
((errno != 0) && (param->threshold == 0)))
{
fprintf(stderr, "Option --capturesize has invalid content %s\n", optarg);
params_free(param);
usage();
}
}
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