[libdvbpsi-devel] exampes/dvbinfo/dvbinfo.c: Dereference after NULL (CID 17248)

Jean-Paul Saman git at videolan.org
Wed Apr 16 15:53:34 CEST 2014


libdvbpsi | branch: master | Jean-Paul Saman <jpsaman at videolan.org> | Fri Apr 11 16:48:41 2014 +0200| [085d158d405226ac6f3f1c6e7deb5ba96ebf4ec9] | committer: Jean-Paul Saman

exampes/dvbinfo/dvbinfo.c: Dereference after NULL (CID 17248)

Use strtoll(optarg, NULL, 10).

> http://git.videolan.org/gitweb.cgi/libdvbpsi.git/?a=commit;h=085d158d405226ac6f3f1c6e7deb5ba96ebf4ec9
---

 examples/dvbinfo/dvbinfo.c |    7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/examples/dvbinfo/dvbinfo.c b/examples/dvbinfo/dvbinfo.c
index c2a4cf2..223b9c4 100644
--- a/examples/dvbinfo/dvbinfo.c
+++ b/examples/dvbinfo/dvbinfo.c
@@ -124,8 +124,8 @@ static void usage(void)
     printf("                         table  = tables and descriptors\n");
     printf("                         packet = decode packets and print structs\n");
 //    printf("                         wire = print arrival time per packet (wireshark like)\n");
-    printf("      --summary-file   : file to write summary information to (default: stdout)\n");
-    printf("      --summary-period : refresh summary file every n milliseconds (default: 1000ms)\n");
+    printf(" -j | --summary-file   : file to write summary information to (default: stdout)\n");
+    printf(" -p | --summary-period : refresh summary file every n milliseconds (default: 1000ms)\n");
 #endif
     exit(EXIT_FAILURE);
 }
@@ -610,8 +610,7 @@ int main(int argc, char **pp_argv)
 
             case 'p':
                 {
-                    char *end = NULL;
-                    param->summary.period = strtoll(optarg, &end, 10);
+                    param->summary.period = strtoll(optarg, NULL, 10);
                     if (((errno == ERANGE) &&
                             ((param->summary.period == LLONG_MIN) ||
                              (param->summary.period == LLONG_MAX))) ||



More information about the libdvbpsi-devel mailing list