Skip to content

Commit 2757637

Browse files
committed
Eliminated warnings reported by gcc 10.2.0.
1 parent 34754b8 commit 2757637

File tree

3 files changed

+15
-3
lines changed

3 files changed

+15
-3
lines changed

src/board.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1437,7 +1437,7 @@ void GetGameListing (
14371437
int numPlies = board.GetCurrentPlyNumber();
14381438
for ( int i=0; i<numPlies && len<bufSize; i++ )
14391439
{
1440-
char moveString [64];
1440+
char moveString[MAX_MOVE_STRLEN + 1];
14411441
char s [64];
14421442
int thisLen = 0;
14431443
Move move = board.GetPastMove(i);

src/chess.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,11 @@
2525

2626
// The Mac OS X build is basically the same as the Linux build,
2727
// so I define CHENARD_LINUX as a helper for conditional compilation.
28-
#define CHENARD_LINUX (defined(__linux__) || defined(__APPLE__))
28+
#if defined(__linux__) || defined(__APPLE__)
29+
# define CHENARD_LINUX 1
30+
#else
31+
# define CHENARD_LINUX 0
32+
#endif
2933

3034
#if CHENARD_LINUX
3135
#define stricmp strcasecmp

src/gamefile.cpp

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -578,7 +578,15 @@ bool GetNextPgnMove (
578578
switch (tagIndex)
579579
{
580580
case 0: // FEN
581-
strncpy(info.fen, token, sizeof(info.fen));
581+
if (strlen(token) < sizeof(info.fen))
582+
{
583+
strcpy(info.fen, token);
584+
}
585+
else
586+
{
587+
state = PGN_FILE_STATE_SYNTAX_ERROR;
588+
goto bail_out;
589+
}
582590
break;
583591

584592
case 1: // WhiteELO

0 commit comments

Comments
 (0)