commit f4252346883661e1801e304ee3c26a83780298ff
parent 5599bd1e0b99211e7bcd543d2f9e63f7ea8b1f2f
Author: hhvn <dev@hhvn.uk>
Date: Thu, 21 Apr 2022 16:19:57 +0100
Prevent comparing config path to unitialized bt array
Diffstat:
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/config.c b/src/config.c
@@ -1465,7 +1465,7 @@ inval:
void
config_read(char *filename) {
- static char **bt;
+ static char **bt = NULL;
static int btoffset = 0;
char buf[8192];
char *path;
@@ -1478,9 +1478,9 @@ config_read(char *filename) {
path = realpath(filename, NULL);
/* Check if file is already being read */
- if (bt) {
+ if (bt && btoffset) {
for (i = 0; i < btoffset; i++) {
- if (strcmp(path, *(bt + i)) == 0) {
+ if (strcmp_n(path, *(bt + i)) == 0) {
ui_error("recursive read of '%s' is not allowed", filename);
pfree(&path);
return;