If you overwrite a buffer that was declared on the stack, that will corrupt the stack. This means that other variables that were declared on the stack will have their values overwritten.
Here is an example of what I mean. Run this program and look at the output:
Code:
#include <stdio.h>
int main(void)
{
int i1 = 0;
int i2 = 0;
int i3 = 0;
int i4 = 0;
char buffer[0];
int count;
for(count = 0; count < sizeof(int) * 4; ++count)
buffer[count] = count;
printf("i1 = %d\n", i1);
printf("i2 = %d\n", i2);
printf("i3 = %d\n", i3);
printf("i4 = %d\n", i4);
return 0;
}