OSDN Git Service

VER0.1.4
[lib1stclass/main.git] / remove_path.c
index 7f55d11..0c920c9 100755 (executable)
@@ -18,7 +18,7 @@ int firstclass::remove_path(const string in_path){
   try {
     path=new char[sizeof(char)*(in_path.length()+1)];
     path[0]='\0';
-    safe_strcat(path, in_path.c_str());
+    safe_strcat(path, in_path.c_str(), in_path.length()+1);
   
 #else
 
@@ -43,9 +43,9 @@ int remove_path(const char *path){
       }
       else{
         char file[512]="";
-        safe_strcat(file, path);
-        safe_strcat(file, "/");
-        safe_strcat(file, dp->d_name);
+        safe_strcat(file, path, sizeof(file));
+        safe_strcat(file, "/", sizeof(file));
+        safe_strcat(file, dp->d_name, sizeof(file));
         remove(file);
       }
     }