diff options
author | Ahmad Fatoum <a.fatoum@pengutronix.de> | 2021-09-22 09:14:40 +0200 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2021-10-01 15:28:49 +0200 |
commit | ff4acaceffb76ad4ad116b876faa7dda9d87c142 (patch) | |
tree | f5243fddc3f30126eba20b6ecc4dcac7ab5f6e8f /common | |
parent | 66d5b73658545cced3e4978712d6963c93c25c80 (diff) | |
download | barebox-ff4acaceffb76ad4ad116b876faa7dda9d87c142.tar.gz barebox-ff4acaceffb76ad4ad116b876faa7dda9d87c142.tar.xz |
common: menutree: prevent read of uninitialized memory in error path
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 <a.fatoum@pengutronix.de>
Link: https://lore.barebox.org/20210922071440.31949-2-a.fatoum@pengutronix.de
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'common')
-rw-r--r-- | common/menutree.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/common/menutree.c b/common/menutree.c index c28284b47a..9a14005ea2 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; |