$OpenBSD$
--- src/FilePath.cxx.orig	Fri Mar 31 21:45:37 2006
+++ src/FilePath.cxx	Fri Mar 31 21:45:37 2006
@@ -245,7 +245,7 @@ static char *split(char*& s, char c) {
 
 FilePath FilePath::NormalizePath() const {
 	char *path = new char[fileName.length() + 1];
-	strcpy(path, AsInternal());
+	strlcpy(path, AsInternal(), fileName.length() + 1);
 #ifdef WIN32
 	// Convert unix path separators to Windows
 	for (char *cp = path; *cp; cp++) {
@@ -276,7 +276,7 @@ FilePath FilePath::NormalizePath() const
 		} else {
 			if (cur > absPath && *(cur - 1) != pathSepChar)
 				*cur++ = pathSepChar;
-			strcpy(cur, part);
+			strlcpy(cur, part, fileName.length() + 1 + (absPath - cur));
 			cur += strlen(part);
 		}
 	}
@@ -307,10 +307,10 @@ FilePath FilePath::VMSToUnixStyle() {
 		if (strstr (vmsName, "//") == NULL) {
 			return FilePath(vmsName);
 		}
-		strcpy(unixStyleFileName, vmsName);
+		strlcpy(unixStyleFileName, vmsName, sizeof(unixStyleFileName));
 		char *p;
 		while ((p = strstr (unixStyleFileName, "//")) != NULL) {
-			strcpy (p, p + 1);
+			strlcpy (p, p + 1, sizeof(p));
 		}
 		return FilePath(unixStyleFileName);
 	}
@@ -320,10 +320,10 @@ FilePath FilePath::VMSToUnixStyle() {
 	// o [dir.dir]file.type
 
 	if (vmsName [0] == '/') {
-		strcpy(unixStyleFileName, vmsName);
+		strlcpy(unixStyleFileName, vmsName, sizeof(unixStyleFileName));
 	} else {
 		unixStyleFileName [0] = '/';
-		strcpy(unixStyleFileName + 1, vmsName);
+		strlcpy(unixStyleFileName + 1, vmsName, sizeof(unixStyleFileName));
 		char *p = strstr(unixStyleFileName, ":[");
 		if (p == NULL) {
 			// o logical:file.type
@@ -331,7 +331,7 @@ FilePath FilePath::VMSToUnixStyle() {
 			*p = '/';
 		} else {
 			*p = '/';
-			strcpy(p + 1, p + 2);
+			strlcpy(p + 1, p + 2, sizeof(p) - 1);
 			char *end = strchr(unixStyleFileName, ']');
 			if (*end != NULL) {
 				*end = '/';
@@ -561,15 +561,15 @@ bool MakeLongPath(const char* shortPath,
 			if ((strlen(shortPath) > 3) &&
 			        (shortPath[0] == '\\') && (shortPath[1] == '\\')) {
 				// UNC, skip first seps
-				strcat(longPath, "\\\\");
-				strcat(longPath, tok);
-				strcat(longPath, "\\");
+				strlcat(longPath, "\\\\", sizeof(longPath));
+				strlcat(longPath, tok, sizeof(longPath));
+				strlcat(longPath, "\\", sizeof(longPath));
 
 				tok = strtok(NULL, "\\");
 				if (tok == NULL)
 					break;
 			}
-			strcat(longPath, tok);
+			strlcat(longPath, tok, sizeof(longPath));
 
 			bool isDir = false;
 
@@ -582,11 +582,11 @@ bool MakeLongPath(const char* shortPath,
 				if (tok == NULL)
 					break;
 
-				strcat(longPath, "\\");
+				strlcat(longPath, "\\", sizeof(longPath));
 				tokend = longPath + strlen(longPath);
 
 				// temporary add short component
-				strcpy(tokend, tok);
+				strlcpy(tokend, tok, sizeof(tokend));
 
 				hfind = ::FindFirstFile(longPath, &fd);
 				if (hfind == INVALID_HANDLE_VALUE)
@@ -595,14 +595,14 @@ bool MakeLongPath(const char* shortPath,
 				isDir = (fd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) != 0;
 
 				// finally add long component we got
-				strcpy(tokend, fd.cFileName);
+				strlcpy(tokend, fd.cFileName, sizeof(tokend));
 
 				::FindClose(hfind);
 			}
 			ok = tok == NULL;
 
 			if (ok && isDir)
-				strcat(longPath, "\\");
+				strlcat(longPath, "\\", sizeof(longPath));
 
 			break;
 		}
