comparison xrogue/options.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 e52a8a7ad4c5
children
comparison
equal deleted inserted replaced
309:11aeff9acc07 310:827441d05b3e
22 */ 22 */
23 23
24 #include <curses.h> 24 #include <curses.h>
25 #include <ctype.h> 25 #include <ctype.h>
26 #include <string.h> 26 #include <string.h>
27 #include <limits.h>
27 #include "rogue.h" 28 #include "rogue.h"
28 29
29 #define NUM_OPTS (sizeof optlist / sizeof (OPTION)) 30 #define NUM_OPTS (sizeof optlist / sizeof (OPTION))
30 31
31 /* 32 /*
522 523
523 /* When getting the scorefile, the new file must be opened. */ 524 /* When getting the scorefile, the new file must be opened. */
524 int 525 int
525 get_score(char *optstr, WINDOW *win) 526 get_score(char *optstr, WINDOW *win)
526 { 527 {
527 char old_score_file[LINELEN]; 528 char old_score_file[PATH_MAX];
528 int status; 529 int status;
529 530
530 if (use_savedir) 531 if (use_savedir)
531 return get_str_prot(optstr, win); 532 return get_str_prot(optstr, win);
532 533