



































Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!




































Or: bringing a knife to a gun fight
char buffer[100]; Declares and allocates an array of 100 chars 100*sizeof(char) (^0 1 )
The following are all legal C (no parse errors, no type errors, etc.) and may generate no run-time errors char buffer[100]; buffer[-1] = ‘a’; buffer[100] = ‘a’; buffer[100000] = ‘a’;
char in[104] = { 0,…,0, magic 4 chars } foo(in); (*) 100 sizeof(char) 0 1 2 99 return address foo entry () 100 *sizeof(char) 0 1 2 99 return address foo exit magic 4 chars