From 3b134b7a603a6fcbcb34276c3c0f3503454be54b Mon Sep 17 00:00:00 2001 From: Demi Marie Obenour Date: Mon, 10 Jan 2022 11:28:51 -0500 Subject: [PATCH] Skip . and .. in root_iterate_callback() This avoids causing problems for other code. --- genfs.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/genfs.c b/genfs.c index 3b5f80ba..6ad82da1 100644 --- a/genfs.c +++ b/genfs.c @@ -111,7 +111,11 @@ static int root_iterate_callback(ext2_ino_t dir __attribute__((unused)), int const name_len = ext2fs_dirent_name_len(dirent); errcode_t err; const char *label = label_modules_object; - if (!strncmp(dirent->name, "firmware", (size_t)name_len)) { + assert(name_len >= 0); + if ((name_len == 1 && dirent->name[0] == '.') || + (name_len == 2 && dirent->name[0] == '.' && dirent->name[1] == '.')) { + return 0; + } else if (!strncmp(dirent->name, "firmware", (size_t)name_len)) { struct qubes_genfs_data relabel_data = { .fs = data->fs, .uname_or_label = label = label_lib,