Do not allow Include option within include files, no recursive include files

Prevent infinitely recursive include files
pull/48/head
Soner Tari 3 years ago
parent 01ff382267
commit ab7674b652

@ -4836,7 +4836,16 @@ set_global_option(global_t *global, const char *argv0,
return global_set_openssl_engine(global, argv0, value);
#endif /* !OPENSSL_NO_ENGINE */
} else if (equal(name, "Include")) {
// Prevent infinitely recursive include files
if (tmp_global_opts->include) {
fprintf(stderr, "Include option not allowed in include files '%s' on line %d\n", value, *line_num);
return -1;
}
tmp_global_opts->include = 1;
int retval = opts_load_conffile(global, argv0, value, natengine, tmp_global_opts);
tmp_global_opts->include = 0;
if (retval == -1) {
fprintf(stderr, "Error in include file '%s' on line %d\n", value, *line_num);
}

@ -313,6 +313,8 @@ typedef struct tmp_global_opts {
// Overrides the divert options of all proxyspecs
// Not equivalent to the conf file Divert option
unsigned int split : 1;
// Prevents Include option in include files
unsigned int include : 1;
} tmp_global_opts_t;
struct global {

Loading…
Cancel
Save