Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Bounds checking for Variable Length Arrays (VLA)?

Is there a way to check for buffer overflows in VLA's ? I used -fstack-protector-all -Wstack-protector but get these warnings:

warning: not protecting local variables: variable length buffer

Is there a library for achieving this ? (-lefence is for heap memory)

I'm currently using Valgrind and gdb.

like image 628
Jan Chou Avatar asked Nov 15 '22 00:11

Jan Chou


1 Answers

You can use -fmudflap instead of -fstack-protector-all

Update: Some documentation and options are here http://gcc.gnu.org/wiki/Mudflap_Pointer_Debugging

like image 67
Ting Chang Avatar answered Dec 17 '22 00:12

Ting Chang