Secure config errors

If user can make NETHACKOPTIONS point to a file, that user could then
get the file contents via the extended config file error reporting.
Add CONFIG_ERROR_SECURE compile-time option to make that case output
only the first error, no line number or error context.
This commit is contained in:
Pasi Kallinen
2017-09-10 21:05:45 +03:00
parent 0d24113577
commit 9c118b5b6b
6 changed files with 38 additions and 17 deletions

View File

@@ -449,6 +449,14 @@ typedef unsigned char uchar;
#define DOAGAIN '\001' /* ^A, the "redo" key used in cmd.c and getline.c */
/* CONFIG_ERROR_SECURE: If user makes NETHACKOPTIONS point to a file ...
* TRUE: Show the first error, nothing else.
* FALSE: Show all errors as normal, with line numbers and context.
*/
#ifndef CONFIG_ERROR_SECURE
# define CONFIG_ERROR_SECURE TRUE
#endif
/*
* Section 4: EXPERIMENTAL STUFF
*

View File

@@ -767,7 +767,7 @@ E void FDECL(unlock_file, (const char *));
#ifdef USER_SOUNDS
E boolean FDECL(can_read_file, (const char *));
#endif
E void FDECL(config_error_init, (BOOLEAN_P, const char *));
E void FDECL(config_error_init, (BOOLEAN_P, const char *, BOOLEAN_P));
E void FDECL(config_error_add, (const char *, ...)) PRINTF_F(1, 2);
E int NDECL(config_error_done);
E boolean FDECL(read_config_file, (const char *, int));