aboutsummaryrefslogtreecommitdiff
path: root/config.c
diff options
context:
space:
mode:
authorLucas de Castro Borges <lucas@gnuabordo.com.br>2024-06-03 22:40:29 -0300
committerLucas de Castro Borges <lucas@gnuabordo.com.br>2024-06-03 22:40:29 -0300
commitfdef1594ca36478db782ea6031593f0c23da7896 (patch)
tree74ad876def62dfe56d38f5816b8d6283e38acdca /config.c
parent8badf9c493c7dd56db5e88e246d5970696795c07 (diff)
New upstream version 1.0.18upstream
Diffstat (limited to 'config.c')
-rw-r--r--config.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/config.c b/config.c
index c249445..238a802 100644
--- a/config.c
+++ b/config.c
@@ -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++;
}