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>
Wed, 26 Mar 2025 08:11:37 +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

index 7b840a6fed4dde79f96ea2f26dedbba8993841fc..b95636de44233bac5375f7bca2553fde214525c7 100644 (file)
@@ -37,7 +37,11 @@ main (int argc, char **argv) {
     return 0;
   }
 
-  strncpy (dir_str, argv[index], PATH_MAX - 1);
+  if (realpath (argv[index], dir_str) == NULL) {
+    cerr << "Invalid path:  " << dir_str << "\n";
+    return -EINVAL;
+  }
+
   DIR *d = opendir (dir_str);
   if (!d) {
     cerr << "Failed to open " << dir_str << "\n";