Skip to content
All tags

#memory-safety

1 posts

How a Few Extra Characters Can Hand Someone Your Program: Buffer Overflows for Beginners

A buffer overflow is data written past the space set aside for it, clobbering whatever sits next door. In the demo, one extra character in a name turns is_admin from 0 into 65; the fix is a length check plus a length-limited function. Canaries, ASLR and NX are extra layers, not guarantees, and AddressSanitizer catches an overflow of a standalone array but, in my test, missed one between fields of the same struct.