/* Search stats from chessprogram */
typedef struct {
- char movelist[MSG_SIZ]; /* Last PV we were sent */
+ char movelist[2*MSG_SIZ]; /* Last PV we were sent */
int depth; /* Current search depth */
int nr_moves; /* Total nr of root moves */
int moves_left; /* Moves remaining to be searched */
* Look for communication commands
*/
if (!strncmp(message, "telluser ", 9)) {
- DisplayInformation(message + 9);
+ DisplayNote(message + 9);
return;
}
if (!strncmp(message, "tellusererror ", 14)) {
SendToICS(buf1);
}
} else {
- DisplayInformation(message + 13);
+ DisplayNote(message + 13);
}
return;
}
SendToICS(buf1);
}
} else {
- DisplayInformation(message + 8);
+ DisplayNote(message + 8);
}
return;
}
programStats.nodes = nodes;
programStats.time = time;
programStats.score = curscore;
- strcpy(programStats.movelist, buf1);
programStats.got_only_move = 0;
+ /* Buffer overflow protection */
+ if (buf1[0] != NULLCHAR) {
+ if (strlen(buf1) >= sizeof(programStats.movelist)
+ && appData.debugMode) {
+ fprintf(debugFP,
+ "PV is too long; using the first %d bytes.\n",
+ sizeof(programStats.movelist) - 1);
+ }
+ strncpy(programStats.movelist, buf1,
+ sizeof(programStats.movelist));
+ programStats.movelist[sizeof(programStats.movelist) - 1]
+ = NULLCHAR;
+ } else {
+ sprintf(programStats.movelist, " no PV\n");
+ }
+
if (programStats.seen_stat) {
programStats.ok_to_send = 1;
}
/* Load first game in the file or popup game menu */
LoadGameFromFile(inFilename, 0, appData.cmailGameName, TRUE);
-#endif // !WIN32
+#endif /* !WIN32 */
return;
}
}
return;
-#endif // !WIN32
+#endif /* !WIN32 */
}
char *
}
}
return cmailMsg;
-#endif // WIN32
+#endif /* WIN32 */
}
void