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-05 19:00:29 -0300 |
| commit | 3bb75df683d55cd2fe257fb5dd37e92d694aec11 (patch) | |
| tree | d0419996a92cfe52a54db6910c47c630b68ad59a /config.c | |
| parent | 04be949e08740712d7db50a9864756f5955f5dd1 (diff) | |
New upstream version 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++; } |
