meson: Ban variable length arrays
Caller-controlled sizes for variable length arrays are bad for the
reasons outlined in the SEI CERT C Coding Standard[1]
Enable -Wvla to prevent future use.
[1]: https://wiki.sei.cmu.edu/confluence/display/c/MEM05-C.+Avoid+large+stack+allocations
Change-Id: Id587bd1432255cff11b419cb5a7f454fc64e2054
Signed-off-by: Andrew Jeffery <andrew@codeconstruct.com.au>
diff --git a/meson.build b/meson.build
index 88969ae..560effb 100644
--- a/meson.build
+++ b/meson.build
@@ -23,6 +23,10 @@
add_project_arguments('-D_GNU_SOURCE', language: ['c'])
compiler = meson.get_compiler('c')
+if compiler.has_argument('-Wvla')
+ add_project_arguments('-Wvla', language: ['c'])
+endif
+
conf = configuration_data()
if compiler.has_header('poll.h')
conf.set('PLDM_HAS_POLL', 1)