From 2c9232113ecb3fdae28a1b2f0ecfe5aa4be2dbf9 Mon Sep 17 00:00:00 2001 From: codemastr Date: Wed, 27 Jun 2001 15:38:10 +0000 Subject: [PATCH] Made glob() used GLOB_LIMIT on OpenBSD 2.9 to try and stop DoSing --- Changes | 2 +- src/s_conf.c | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/Changes b/Changes index 72c05e6f2..e04dacd9a 100644 --- a/Changes +++ b/Changes @@ -613,4 +613,4 @@ seen. gmtime warning still there - Added configure check for glob.h - Added the ability to use file globs in loadmodule and include (only if your system has glob) - Added ./Config option to enable IPv6 (and made a configure check to make sure we can) - +- Made glob() use GLOB_LIMIT on OpenBSD 2.9 to help prevent a DoS diff --git a/src/s_conf.c b/src/s_conf.c index 8568c41a3..28b4572be 100644 --- a/src/s_conf.c +++ b/src/s_conf.c @@ -924,7 +924,11 @@ int _conf_include(ConfigFile *conf, ConfigEntry *ce) chmod(ce->ce_vardata, DEFAULT_PERMISSIONS); #endif #ifdef GLOBH +#if defined(__OpenBSD__) && defined(GLOB_LIMIT) + glob(ce->ce_vardata, GLOB_NOSORT|GLOB_NOCHECK|GLOB_LIMIT, NULL, &files); +#else glob(ce->ce_vardata, GLOB_NOSORT|GLOB_NOCHECK, NULL, &files); +#endif if (!files.gl_pathc) { globfree(&files); config_error("%s:%i: include %s: invalid file given", @@ -1157,7 +1161,11 @@ int _conf_loadmodule(ConfigFile *conf, ConfigEntry *ce) return -1; } #ifdef GLOBH +#if defined(__OpenBSD__) && defined(GLOB_LIMIT) + glob(ce->ce_vardata, GLOB_NOSORT|GLOB_NOCHECK|GLOB_LIMIT, NULL, &files); +#else glob(ce->ce_vardata, GLOB_NOSORT|GLOB_NOCHECK, NULL, &files); +#endif if (!files.gl_pathc) { globfree(&files); config_error("%s:%i: loadmodule %s: failed to load",