[DynInst_API:] [PATCH] test_driver: fix a strcpy in updateSearchPaths


Date: Thu, 28 Feb 2013 12:41:24 -0800
From: Josh Stone <jistone@xxxxxxxxxx>
Subject: [DynInst_API:] [PATCH] test_driver: fix a strcpy in updateSearchPaths
The code was using a couple strcats on a freshly malloced buffer.  The
first should be strcpy since the buffer is not yet initialized.
---
 testsuite/src/test_driver.C | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/testsuite/src/test_driver.C b/testsuite/src/test_driver.C
index 02eec1a..0fc3117 100644
--- a/testsuite/src/test_driver.C
+++ b/testsuite/src/test_driver.C
@@ -755,7 +755,7 @@ void updateSearchPaths(const char *filename) {
       // Add current directory to the search path
       const char *pathenv = getenv("PATH");
       char *newpath = (char *) malloc (strlen(pathenv)+3);
-      strcat(newpath, pathenv);
+      strcpy(newpath, pathenv);
       strcat(newpath, ":.");
       execpath = searchPath(newpath, filename);
       if(execpath == NULL) {
-- 
1.8.1.2

[← Prev in Thread] Current Thread [Next in Thread→]
  • [DynInst_API:] [PATCH] test_driver: fix a strcpy in updateSearchPaths, Josh Stone <=