[BACK]Return to patch-src_helper_fileio_c CVS log [TXT][DIR] Up to [local] / ports / devel / openocd / patches

File: [local] / ports / devel / openocd / patches / Attic / patch-src_helper_fileio_c (download)

Revision 1.1, Wed May 27 12:11:51 2009 UTC (15 years, 1 month ago) by yason
Branch: MAIN

Initial revision

$OpenBSD$
--- src/helper/fileio.c.orig	Fri Jan 16 10:02:25 2009
+++ src/helper/fileio.c	Wed May 27 11:20:39 2009
@@ -53,19 +53,19 @@ int fileio_open_local(fileio_t *fileio)
 	switch (fileio->access)
 	{
 		case FILEIO_READ:
-			strcpy(access, "r");
+			strlcpy(access, "r", sizeof(access));
 			break;
 		case FILEIO_WRITE:
-			strcpy(access, "w");
+			strlcpy(access, "w", sizeof(access));
 			break;
 		case FILEIO_READWRITE:
-			strcpy(access, "w+");
+			strlcpy(access, "w+", sizeof(access));
 			break;
 		case FILEIO_APPEND:
-			strcpy(access, "a");	
+			strlcpy(access, "a", sizeof(access));	
 			break;
 		case FILEIO_APPENDREAD:
-			strcpy(access, "a+");	
+			strlcpy(access, "a+", sizeof(access));	
 			break;
 		default:
 			LOG_ERROR("BUG: access neither read, write nor readwrite");
@@ -77,7 +77,7 @@ int fileio_open_local(fileio_t *fileio)
 	if (fileio->type == FILEIO_BINARY)
 #endif
 	{
-		strcat(access, "b");
+		strlcat(access, "b", sizeof(access));
 	}
 	
 	if (!(fileio->file = open_file_from_path (fileio->url, access)))