This question already has an answer here:

I am currently learning about the stack, in particular how to perform stack overflow attacks. I understand that the buffer is not the size that the program initially set it as, for example if we deployed a buffer like this char buffer [100], when compiled the buffer size will end up being greater than 100. What data does the compiler add to the initial 100 bytes of data?

marked as duplicate by julian, perror, NirIzr, 0xec, Igor Skochinsky Jun 22 '17 at 8:36

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.


char buffer [0x100 ]. as local that ends up in stack is filled with junk. (uninitilised buffer )

same buffer if declared as global is zero initialised ie the complete buffer will have 0x0's

compiler can pad your buffer based on alignment

can embed patterns based on debug versus release builds

these are implementation details and subject to chsnge between versions

Not the answer you're looking for? Browse other questions tagged or ask your own question.