summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpgen <p.gen.progs@gmail.com>2022-03-06 11:27:52 +0100
committerpgen <p.gen.progs@gmail.com>2022-03-06 11:30:20 +0100
commit02f1084e8c0338dc93ad890631e62866b0a14b42 (patch)
treefd10bb299345923fd5e9a4a1516bb13c3abc5804
parent79c36e035dd8a3ffe16599d0bd4d194d4aadb700 (diff)
Fix a potential segfault when allocating ini paths
-rw-r--r--smenu.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/smenu.c b/smenu.c
index 3a4be37..95a764e 100644
--- a/smenu.c
+++ b/smenu.c
@@ -829,7 +829,7 @@ make_ini_path(char * name, char * base)
len = strlen(home) + strlen(name) + 3;
if (path_max < 0)
- path_max = 4096; /* POSIX minimal value. */
+ path_max = 4096; /* POSIX minimal value. path_max >= 4096. */
if (len <= path_max)
{
@@ -840,7 +840,7 @@ make_ini_path(char * name, char * base)
else
conf = name;
- snprintf(path, 4096, "%s/.%s", home, conf);
+ snprintf(path, len, "%s/.%s", home, conf);
}
else
path = NULL;