:: commit ab0dfc2123603261a6d9b4c017dbf7986cb018a2

mintsuki <mintsuki@protonmail.com> — 2022-02-18 00:09

parents: 7acad99ced

misc: Make VLAs a warning

diff --git a/common/GNUmakefile b/common/GNUmakefile
index 38924924..60fa37d8 100644
--- a/common/GNUmakefile
+++ b/common/GNUmakefile
@@ -53,6 +53,7 @@ override INTERNAL_CFLAGS := \
 	-nostdinc \
 	-Wno-address-of-packed-member \
 	-Wshadow \
+	-Wvla \
 	-mno-80387 \
 	-mno-mmx \
 	-mno-3dnow \
diff --git a/common/fs/ext2.s2.c b/common/fs/ext2.s2.c
index 1e7a7791..82c8a6c4 100644
--- a/common/fs/ext2.s2.c
+++ b/common/fs/ext2.s2.c
@@ -271,13 +271,16 @@ next:
                    &current_inode, fd, alloc_map);
 
         // name read
-        char name[dir->name_len + 1];
+        char *name = ext_mem_alloc(dir->name_len + 1);
 
         memset(name, 0, dir->name_len + 1);
         inode_read(name, i + sizeof(struct ext2_dir_entry), dir->name_len,
                    &current_inode, fd, alloc_map);
 
-        if (!strcmp(token, name)) {
+        int test = strcmp(token, name);
+        pmm_free(name, dir->name_len + 1);
+
+        if (test == 0) {
             if (escape) {
                 ret = true;
                 goto out;
diff --git a/decompressor/GNUmakefile b/decompressor/GNUmakefile
index fb307ff1..543578fd 100644
--- a/decompressor/GNUmakefile
+++ b/decompressor/GNUmakefile
@@ -31,6 +31,8 @@ override INTERNAL_CFLAGS := \
 	-fomit-frame-pointer \
 	-nostdinc \
 	-Wno-address-of-packed-member \
+	-Wshadow \
+	-Wvla \
 	-mno-80387 \
 	-mno-mmx \
 	-mno-3dnow \
tab: 248 wrap: offon