[libdvbpsi-devel] dvbinfo: check optarg
Jean-Paul Saman
git at videolan.org
Thu Jan 8 09:29:05 CET 2015
libdvbpsi | branch: master | Jean-Paul Saman <jean-paul.saman at m2x.nl> | Wed Dec 24 13:15:09 2014 +0100| [708ed766472bb114cadcf305e8f403cd0304b81c] | committer: Jean-Paul Saman
dvbinfo: check optarg
> http://git.videolan.org/gitweb.cgi/libdvbpsi.git/?a=commit;h=708ed766472bb114cadcf305e8f403cd0304b81c
---
examples/dvbinfo/dvbinfo.c | 15 +++++++++------
1 file changed, 9 insertions(+), 6 deletions(-)
diff --git a/examples/dvbinfo/dvbinfo.c b/examples/dvbinfo/dvbinfo.c
index 5b17246..3ae3f70 100644
--- a/examples/dvbinfo/dvbinfo.c
+++ b/examples/dvbinfo/dvbinfo.c
@@ -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;
More information about the libdvbpsi-devel
mailing list