Commit 1722b1da authored by Jean-Paul Saman's avatar Jean-Paul Saman

dvbinfo: Dereference after NULL check (CID 17248)

parent 1f9cf2f2
...@@ -507,7 +507,7 @@ int main(int argc, char **pp_argv) ...@@ -507,7 +507,7 @@ int main(int argc, char **pp_argv)
{ NULL, 0, NULL, 0 } { NULL, 0, NULL, 0 }
}; };
#ifdef HAVE_SYS_SOCKET_H #ifdef HAVE_SYS_SOCKET_H
while ((c = getopt_long(argc, pp_argv, "a:d:f:i:ho:ms:tu", long_options, NULL)) != -1) while ((c = getopt_long(argc, pp_argv, "a:d:f:i:j:ho:p:ms:tu", long_options, NULL)) != -1)
#else #else
while ((c = getopt_long(argc, pp_argv, "d:f:h", long_options, NULL)) != -1) while ((c = getopt_long(argc, pp_argv, "d:f:h", long_options, NULL)) != -1)
#endif #endif
...@@ -603,7 +603,8 @@ int main(int argc, char **pp_argv) ...@@ -603,7 +603,8 @@ int main(int argc, char **pp_argv)
/* - Statistics */ /* - Statistics */
case 's': case 's':
{ {
param->b_summary = true; if (optarg)
{
ssize_t size = ARRAY_SIZE(psz_summary_mode); ssize_t size = ARRAY_SIZE(psz_summary_mode);
for (ssize_t i = 0; i < size; i++) for (ssize_t i = 0; i < size; i++)
{ {
...@@ -611,9 +612,17 @@ int main(int argc, char **pp_argv) ...@@ -611,9 +612,17 @@ int main(int argc, char **pp_argv)
if (strncmp(optarg, psz_summary_mode[i], strlen(psz_summary_mode[i])) == 0) if (strncmp(optarg, psz_summary_mode[i], strlen(psz_summary_mode[i])) == 0)
{ {
param->summary.mode = i_summary_mode[i]; param->summary.mode = i_summary_mode[i];
param->b_summary = true;
break; break;
} }
} }
}
if (!param->b_summary)
{
fprintf(stderr, "Option --summary has invalid content %s\n", optarg);
params_free(param);
usage();
}
break; break;
} }
case 'j': case 'j':
...@@ -628,6 +637,7 @@ int main(int argc, char **pp_argv) ...@@ -628,6 +637,7 @@ int main(int argc, char **pp_argv)
break; break;
case 'p': case 'p':
if (optarg)
{ {
param->summary.period = strtoll(optarg, NULL, 10); param->summary.period = strtoll(optarg, NULL, 10);
if (((errno == ERANGE) && if (((errno == ERANGE) &&
......
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