diff arogue7/rogue.c @ 310:827441d05b3e

Advanced Rogue family: fix some potential buffer overflows. Some code for determining the score file location assumed that PATH_MAX would be less than 1024, which cannot be guaranteed. Advanced Rogue 5 and 7, and XRogue, have had the buffers for the file name enlarged. UltraRogue never called the functions, so the code has been deleted instead.
author John "Elwin" Edwards
date Mon, 03 May 2021 19:05:37 -0400
parents 0250220d8cdd
children
line wrap: on
line diff
--- a/arogue7/rogue.c	Sun May 02 21:54:11 2021 -0400
+++ b/arogue7/rogue.c	Mon May 03 19:05:37 2021 -0400
@@ -13,6 +13,7 @@
  */
 
 #include <ctype.h>
+#include <limits.h>
 #include "curses.h"
 #include "rogue.h"
 #ifdef PC7300
@@ -102,7 +103,7 @@
 char *m_guess[MAXMM];			/* Players guess at what MM is */
 char *ws_type[MAXSTICKS];		/* Is it a wand or a staff */
 char file_name[LINELEN];		/* Save file name */
-char score_file[LINELEN];		/* Score file name */
+char score_file[PATH_MAX];		/* Score file name */
 char home[LINELEN];			/* User's home directory */
 WINDOW *cw;				/* Window that the player sees */
 WINDOW *hw;				/* Used for the help command */