diff --git a/apps/createsamples/utility.cpp b/apps/createsamples/utility.cpp index 5176f14836..e94792b1e4 100644 --- a/apps/createsamples/utility.cpp +++ b/apps/createsamples/utility.cpp @@ -70,7 +70,7 @@ using namespace cv; static int icvMkDir( const char* filename ) { - char path[PATH_MAX]; + char path[PATH_MAX+1]; char* p; int pos; @@ -83,7 +83,8 @@ static int icvMkDir( const char* filename ) mode = 0755; #endif /* _WIN32 */ - strcpy( path, filename ); + path[0] = '\0'; + strncat( path, filename, PATH_MAX ); p = path; for( ; ; )