Tests: Resolve an SVACE issue (#58850)
authorWook Song <wook16.song@samsung.com>
Tue, 25 Mar 2025 04:33:18 +0000 (13:33 +0900)
committerWook Song <wook16.song@samsung.com>
Tue, 25 Mar 2025 08:11:55 +0000 (17:11 +0900)
This patch resolves an SVACE issue, #58850, which is related to
TAINTED_PTR.

Change-Id: I8f43270775d0cd7df00ec1ae8f7d9d1ab7d9b347
Signed-off-by: Wook Song <wook16.song@samsung.com>
tests/apptests/tvn_triv2_bulk.cc
tests/utils/ne_test_utils.h

index d36d12e87d8e7b48d1167092339831cda02644a4..7b840a6fed4dde79f96ea2f26dedbba8993841fc 100644 (file)
@@ -26,7 +26,7 @@ using namespace std;
 int
 main (int argc, char **argv) {
   UtilTRIV2 tester;
-  char *dir_str;
+  char dir_str[PATH_MAX];
   int task_id, status, index;
 
   std::ios_base::fmtflags f (cerr.flags ());
@@ -37,7 +37,7 @@ main (int argc, char **argv) {
     return 0;
   }
 
-  dir_str = argv[index];
+  strncpy (dir_str, argv[index], PATH_MAX - 1);
   DIR *d = opendir (dir_str);
   if (!d) {
     cerr << "Failed to open " << dir_str << "\n";
index 00ba669220e050f0f1ec38c20112fdff8340f06b..dc0f3aec21674d4e2ae0a7c995246492f5a1dcb0 100644 (file)
 
 #include "ne_test_utils_common.h"
 
+#include <limits.h>
+
+#ifndef PATH_MAX
+#define PATH_MAX 4096
+#endif
+
 #include <libnpuhost.h>
 #include <npubinfmt.h>
 #include <stddef.h>