...
Validate size arguments used in VLA declarations. The solution below ensures the size argument, s
, used to allocate vla
is in a valid range: 1 to a user defined constant.
Code Block | ||
---|---|---|
| ||
#defineenum { MAX_ARRAY = 1024 }; void func(size_t s) { int vla[s]; /* ... */ } /* ... */ if (s < MAX_ARRAY && s != 0) { func(s); } else { /* Handle Error */ } /* ... */ |
...