comparison arogue5/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
comparison
equal deleted inserted replaced
309:11aeff9acc07 310:827441d05b3e
11 * 11 *
12 * See the file LICENSE.TXT for full copyright and licensing information. 12 * See the file LICENSE.TXT for full copyright and licensing information.
13 */ 13 */
14 14
15 #include <ctype.h> 15 #include <ctype.h>
16 #include <limits.h>
16 #include "curses.h" 17 #include "curses.h"
17 #include "rogue.h" 18 #include "rogue.h"
18 19
19 /* 20 /*
20 * Now all the global variables 21 * Now all the global variables
83 char *r_guess[MAXRINGS]; /* Players guess at what ring is */ 84 char *r_guess[MAXRINGS]; /* Players guess at what ring is */
84 char *ws_guess[MAXSTICKS]; /* Players guess at what wand is */ 85 char *ws_guess[MAXSTICKS]; /* Players guess at what wand is */
85 char *m_guess[MAXMM]; /* Players guess at what MM is */ 86 char *m_guess[MAXMM]; /* Players guess at what MM is */
86 char *ws_type[MAXSTICKS]; /* Is it a wand or a staff */ 87 char *ws_type[MAXSTICKS]; /* Is it a wand or a staff */
87 char file_name[256]; /* Save file name */ 88 char file_name[256]; /* Save file name */
88 char score_file[LINELEN]; /* Score file name */ 89 char score_file[PATH_MAX]; /* Score file name */
89 char home[LINELEN]; /* User's home directory */ 90 char home[LINELEN]; /* User's home directory */
90 WINDOW *cw; /* Window that the player sees */ 91 WINDOW *cw; /* Window that the player sees */
91 WINDOW *hw; /* Used for the help command */ 92 WINDOW *hw; /* Used for the help command */
92 WINDOW *mw; /* Used to store mosnters */ 93 WINDOW *mw; /* Used to store mosnters */
93 WINDOW *msgw; /* Used to display messages */ 94 WINDOW *msgw; /* Used to display messages */