diff --git a/CMakeLists.txt b/CMakeLists.txt index be052dfaa..f22a5a23f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -134,7 +134,7 @@ else() message(STATUS "Threads type: disabled") endif() -set(WARNING_FLAGS "-Wall -Wextra -Wconversion -Werror=uninitialized -Werror=return-type") +set(WARNING_FLAGS "-Wall -Wextra -Wconversion -Werror=uninitialized -Werror=return-type -Werror=vla") set(CMAKE_C_STANDARD 11) set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${WARNING_FLAGS} -Werror=incompatible-pointer-types -Werror=implicit-function-declaration -Werror=int-conversion") diff --git a/src/detection/btrfs/btrfs_linux.c b/src/detection/btrfs/btrfs_linux.c index 3685a153d..d9aed2586 100644 --- a/src/detection/btrfs/btrfs_linux.c +++ b/src/detection/btrfs/btrfs_linux.c @@ -24,7 +24,7 @@ static const char* enumerateDevices(FFBtrfsResult* item, int dfd, FFstrbuf* buff ffStrbufAppendC(&item->devices, ','); ffStrbufAppendS(&item->devices, entry->d_name); - char path[ARRAY_SIZE(entry->d_name) + ARRAY_SIZE("/size") + 1]; + char path[sizeof(entry->d_name) + sizeof("/size") + 1]; snprintf(path, ARRAY_SIZE(path), "%s/size", entry->d_name); if (ffReadFileBufferRelative(subfd, path, buffer)) diff --git a/src/detection/physicaldisk/physicaldisk_linux.c b/src/detection/physicaldisk/physicaldisk_linux.c index ed1fa87be..b4c88e0e2 100644 --- a/src/detection/physicaldisk/physicaldisk_linux.c +++ b/src/detection/physicaldisk/physicaldisk_linux.c @@ -173,7 +173,7 @@ const char* ffDetectPhysicalDisk(FFlist* result, FFPhysicalDiskOptions* options) if (devName[0] == '.') continue; - char pathSysBlock[ARRAY_SIZE("/sys/block/") + ARRAY_SIZE(sysBlockEntry->d_name)]; + char pathSysBlock[sizeof("/sys/block/") + sizeof(sysBlockEntry->d_name)]; snprintf(pathSysBlock, ARRAY_SIZE(pathSysBlock), "/sys/block/%s", devName); int dfd = openat(dirfd(sysBlockDirp), devName, O_RDONLY | O_CLOEXEC | O_PATH | O_DIRECTORY);