Commit Diff


commit - 9a6f35d1144f9f50bcc138716e91666af257d439
commit + 679bf294d1a0924d7783ab6748f1ff327200373b
blob - f8da9fd38b5d2b42c49b02cf551e89a99f8750a8
blob + 7b1d44e3b43f8ee52c529942ead229b5ffd2d351
--- FICS/gamedb.c
+++ FICS/gamedb.c
@@ -44,6 +44,10 @@
 #include "rmalloc.h"
 #include "utils.h"
 
+#if __linux__
+#include <bsd/string.h>
+#endif
+
 /*
  * This should be enough to hold any game up to at least 250 moves. If
  * we overwrite this, the server will crash.
@@ -206,7 +210,7 @@ game_time_str(int wt, int winc, int bt, int binc)
 	static char	tstr[50] = { '\0' };
 
 	if ((!wt) && (!winc)) { // Untimed
-		strcpy(tstr, "");
+		(void) strlcpy(tstr, "", sizeof tstr);
 		return tstr;
 	}
 
@@ -1142,13 +1146,13 @@ ReadOneV1Move(FILE *fp, move_t *m)
 		PieceChar	= PieceToChar(piecetype(piece) | WHITE);
 
 		if (PieceChar == 'K' && m->fromFile == 4 && m->toFile == 6) {
-			strcpy(m->algString, "O-O");
-			strcpy(m->moveString, "o-o");
+			mstrlcpy(m->algString, "O-O", sizeof(m->algString));
+			mstrlcpy(m->moveString, "o-o", sizeof(m->moveString));
 		} else if (PieceChar == 'K' &&
 		    m->fromFile == 4 &&
 		    m->toFile == 2) {
-			strcpy(m->algString, "O-O-O");
-			strcpy(m->moveString, "o-o-o");
+			mstrlcpy(m->algString, "O-O-O", sizeof(m->algString));
+			mstrlcpy(m->moveString, "o-o-o", sizeof(m->moveString));
 		} else {
 			i = 0;
 			m->algString[i++] = PieceChar;