diff options
| author | Lucas de Castro Borges <lucas@gnuabordo.com.br> | 2024-06-03 22:40:29 -0300 |
|---|---|---|
| committer | Lucas de Castro Borges <lucas@gnuabordo.com.br> | 2024-06-03 22:48:44 -0300 |
| commit | 18daa36e5531db0aeb9454a694ab79ddd840986e (patch) | |
| tree | 44520c48bc87fdaf79bc2dcdbfaee5a68021b56a /config.c | |
| parent | e0c6ccf0ade7b6eddbe888590eec1b7d21f1051b (diff) | |
New upstream version 1.0.18upstream/1.0.18
Diffstat (limited to 'config.c')
| -rw-r--r-- | config.c | 5 |
1 files changed, 3 insertions, 2 deletions
@@ -18,6 +18,7 @@ License: GPLv2 #include <unistd.h> #include <dirent.h> +#include <linux/limits.h> #include <fnmatch.h> #include "config.h" @@ -181,7 +182,7 @@ void init_config(void) static int find_all_configs(char* fn, int mustexist, CONFIG **first, CONFIG **last, GROUPS **firstg, GROUPS **lastg) { struct dirent **namelist; - char dir[BUFSIZ], pattern[128], *p, s[BUFSIZ]; + char dir[PATH_MAX - NAME_MAX - 1], pattern[128], *p, s[PATH_MAX]; int n, i, found; /* Split fn to dir/pattern */ @@ -208,7 +209,7 @@ static int find_all_configs(char* fn, int mustexist, CONFIG **first, CONFIG **la for (i = 0; i < n; i++) { if (fnmatch(pattern, namelist[i]->d_name, 0) == 0 && fnmatch("*~", namelist[i]->d_name, 0) != 0) { - snprintf(s, BUFSIZ, "%s/%s", dir, namelist[i]->d_name); + snprintf(s, PATH_MAX, "%s/%s", dir, namelist[i]->d_name); read_one_config(s, first, last, firstg, lastg); found++; } |
