From 889efb2fcb470892a0d800d40517a1f1e4284d51 Mon Sep 17 00:00:00 2001 From: Walid Boudebouda Date: Tue, 7 Jan 2025 14:41:03 +0100 Subject: [PATCH] VCC: Fix +glob with relative paths Fixes: #4249 --- lib/libvcc/vcc_source.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/lib/libvcc/vcc_source.c b/lib/libvcc/vcc_source.c index f717e1192b9..7b176b4a153 100644 --- a/lib/libvcc/vcc_source.c +++ b/lib/libvcc/vcc_source.c @@ -107,9 +107,24 @@ vcc_include_glob_file(struct vcc *tl, const struct source *src_sp, const char *filename, const struct token *parent_token) { glob_t g[1]; + char **paths, **p; unsigned u; int i; + if (filename[0] != '/') { + paths = VFIL_concat(tl->vcl_path, filename); + p = paths; + while (*p != NULL) { + assert(*p[0] == '/'); + vcc_include_glob_file(tl, src_sp, *p, parent_token); + free(*p); + *p = NULL; + p++; + } + free(paths); + return; + } + memset(g, 0, sizeof g); i = glob(filename, 0, NULL, g); switch (i) {