Mercurial > hg > early-roguelike
comparison arogue7/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 |
|---|---|
| 19 * | 19 * |
| 20 */ | 20 */ |
| 21 | 21 |
| 22 #include "curses.h" | 22 #include "curses.h" |
| 23 #include <ctype.h> | 23 #include <ctype.h> |
| 24 #include <limits.h> | |
| 24 #include <string.h> | 25 #include <string.h> |
| 25 #include "rogue.h" | 26 #include "rogue.h" |
| 26 | 27 |
| 27 #define NUM_OPTS (sizeof optlist / sizeof (OPTION)) | 28 #define NUM_OPTS (sizeof optlist / sizeof (OPTION)) |
| 28 | 29 |
| 489 | 490 |
| 490 /* When getting the scorefile, the new file must be opened. */ | 491 /* When getting the scorefile, the new file must be opened. */ |
| 491 int | 492 int |
| 492 get_score(char *optstr, WINDOW *win) | 493 get_score(char *optstr, WINDOW *win) |
| 493 { | 494 { |
| 494 char old_score_file[LINELEN]; | 495 char old_score_file[PATH_MAX]; |
| 495 int status; | 496 int status; |
| 496 | 497 |
| 497 if (use_savedir) | 498 if (use_savedir) |
| 498 return get_str_prot(optstr, win); | 499 return get_str_prot(optstr, win); |
| 499 | 500 |
