First steps toward getting full system to work with
[gem5.git] / base / inifile.cc
index 862e4082f805c333c93920a985f0ba2e74cd7ccf..eb5a1335f51f49628cb9099023abfe1e76b860e5 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001-2004 The Regents of The University of Michigan
+ * Copyright (c) 2001-2005 The Regents of The University of Michigan
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -79,7 +79,8 @@ IniFile::loadCPP(const string &file, vector<char *> &cppArgs)
 
     tmpf.close();
 
-    char *cfile = strcpy(new char[file.size() + 1], file.c_str());
+    char *cfile = strncpy(new char[file.size() + 1], file.c_str(),
+                          file.size());
     char *dir = dirname(cfile);
     char *dir_arg = NULL;
     if (*dir != '.') {
@@ -87,7 +88,7 @@ IniFile::loadCPP(const string &file, vector<char *> &cppArgs)
         arg += dir;
 
         dir_arg = new char[arg.size() + 1];
-        strcpy(dir_arg, arg.c_str());
+        strncpy(dir_arg, arg.c_str(), arg.size());
     }
 
     delete [] cfile;