Skip to content

Commit fdbd8d9

Browse files
committed
Chore: forbid using of VLAs
1 parent 1cad1df commit fdbd8d9

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ else()
134134
message(STATUS "Threads type: disabled")
135135
endif()
136136

137-
set(WARNING_FLAGS "-Wall -Wextra -Wconversion -Werror=uninitialized -Werror=return-type")
137+
set(WARNING_FLAGS "-Wall -Wextra -Wconversion -Werror=uninitialized -Werror=return-type -Werror=vla")
138138

139139
set(CMAKE_C_STANDARD 11)
140140
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${WARNING_FLAGS} -Werror=incompatible-pointer-types -Werror=implicit-function-declaration -Werror=int-conversion")

src/detection/btrfs/btrfs_linux.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ static const char* enumerateDevices(FFBtrfsResult* item, int dfd, FFstrbuf* buff
2424
ffStrbufAppendC(&item->devices, ',');
2525
ffStrbufAppendS(&item->devices, entry->d_name);
2626

27-
char path[ARRAY_SIZE(entry->d_name) + ARRAY_SIZE("/size") + 1];
27+
char path[sizeof(entry->d_name) + sizeof("/size") + 1];
2828
snprintf(path, ARRAY_SIZE(path), "%s/size", entry->d_name);
2929

3030
if (ffReadFileBufferRelative(subfd, path, buffer))

src/detection/physicaldisk/physicaldisk_linux.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ const char* ffDetectPhysicalDisk(FFlist* result, FFPhysicalDiskOptions* options)
173173
if (devName[0] == '.')
174174
continue;
175175

176-
char pathSysBlock[ARRAY_SIZE("/sys/block/") + ARRAY_SIZE(sysBlockEntry->d_name)];
176+
char pathSysBlock[sizeof("/sys/block/") + sizeof(sysBlockEntry->d_name)];
177177
snprintf(pathSysBlock, ARRAY_SIZE(pathSysBlock), "/sys/block/%s", devName);
178178

179179
int dfd = openat(dirfd(sysBlockDirp), devName, O_RDONLY | O_CLOEXEC | O_PATH | O_DIRECTORY);

0 commit comments

Comments
 (0)