Fix buffer overflow bug in unit test (#1193)
authorРоман Михайлович Русяев/AI Tools Lab /SRR/Staff Engineer/삼성전자 <r.rusyaev@samsung.com>
Mon, 27 Aug 2018 09:55:34 +0000 (12:55 +0300)
committerSergey Vostokov/AI Tools Lab /SRR/Staff Engineer/삼성전자 <s.vostokov@samsung.com>
Mon, 27 Aug 2018 09:55:34 +0000 (12:55 +0300)
* add nullptr to end of argv and correct argc

Signed-off-by: Roman Rusyaev <r.rusyaev@samsung.com>
contrib/nnc/unittests/support/CommandLineTest.cpp

index 517c21d..a9e278b 100644 (file)
@@ -135,9 +135,9 @@ TEST(SUPPORT_NNC, verify_cl_options)
                         "-dash_opt", "-",
                         // bool options
                         "-bool_opt=false",
-                        "-bool-opt2"};
-
-  int argc = sizeof(argv) / sizeof(argv[0]);
+                        "-bool-opt2",
+                        nullptr};
+  int argc = (sizeof(argv) / sizeof(argv[0])) - 1;
 
   // parse command line
   CommandLine::getParser()->parseCommandLine(argc, argv);