globfree() is a no-op if glob_t::gl_pathv is NULL. A failed glob may not
always initialize this member however, leading to potential memory
corruption.

Fix this by initializing glob_t.

Signed-off-by: Ahmad Fatoum <[email protected]>
---
 common/menutree.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/common/menutree.c b/common/menutree.c
index c28284b47a0c..9a14005ea209 100644
--- a/common/menutree.c
+++ b/common/menutree.c
@@ -84,7 +84,7 @@ int menutree(const char *path, int toplevel)
        struct stat s;
        char *box;
        struct menutree *mt;
-       glob_t g;
+       glob_t g = {};
        int i;
        char *globpath, *display;
        size_t size;
-- 
2.30.2


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox

Reply via email to