Mercurial > hg > early-roguelike
comparison arogue5/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 |
|---|---|
| 15 */ | 15 */ |
| 16 | 16 |
| 17 #include "curses.h" | 17 #include "curses.h" |
| 18 #include <ctype.h> | 18 #include <ctype.h> |
| 19 #include <string.h> | 19 #include <string.h> |
| 20 #include <limits.h> | |
| 20 #include "rogue.h" | 21 #include "rogue.h" |
| 21 | 22 |
| 22 #define NUM_OPTS (sizeof optlist / sizeof (OPTION)) | 23 #define NUM_OPTS (sizeof optlist / sizeof (OPTION)) |
| 23 | 24 |
| 24 | 25 |
| 89 } | 90 } |
| 90 | 91 |
| 91 /* For the score file, which must be opened. */ | 92 /* For the score file, which must be opened. */ |
| 92 int get_score(char *optstr, WINDOW *win) | 93 int get_score(char *optstr, WINDOW *win) |
| 93 { | 94 { |
| 94 char old_score_file[LINELEN]; | 95 char old_score_file[PATH_MAX]; |
| 95 int status; | 96 int status; |
| 96 | 97 |
| 97 if (use_savedir) | 98 if (use_savedir) |
| 98 return get_restr(optstr, win); | 99 return get_restr(optstr, win); |
| 99 | 100 |
