From e42f0473fc7c7e4dd92c10d583aca62b43134a8c Mon Sep 17 00:00:00 2001 From: =?utf8?q?=D0=A0=D0=BE=D0=BC=D0=B0=D0=BD=20=D0=9C=D0=B8=D1=85=D0=B0?= =?utf8?q?=D0=B9=D0=BB=D0=BE=D0=B2=D0=B8=D1=87=20=D0=A0=D1=83=D1=81=D1=8F?= =?utf8?q?=D0=B5=D0=B2/AI=20Tools=20Lab=20/SRR/Staff=20Engineer/=EC=82=BC?= =?utf8?q?=EC=84=B1=EC=A0=84=EC=9E=90?= Date: Mon, 27 Aug 2018 12:55:34 +0300 Subject: [PATCH] Fix buffer overflow bug in unit test (#1193) * add nullptr to end of argv and correct argc Signed-off-by: Roman Rusyaev --- contrib/nnc/unittests/support/CommandLineTest.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/contrib/nnc/unittests/support/CommandLineTest.cpp b/contrib/nnc/unittests/support/CommandLineTest.cpp index 517c21d..a9e278b 100644 --- a/contrib/nnc/unittests/support/CommandLineTest.cpp +++ b/contrib/nnc/unittests/support/CommandLineTest.cpp @@ -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); -- 2.7.4