Most likely the overflow is being written into other variables in your program.
Try this:
Code:
#include <stdio.h>
#include <string.h>
int main()
{
char t2[10];
char t1[10];
strcpy(t1, "four");
strcpy(t2, "abcdefghi");
printf("t1:[%s] t2:[%s] \n", t1, t2);
strcat(t1, "five");
printf("t1:[%s] t2:[%s] \n", t1, t2);
strcat(t1, "six");
printf("t1:[%s] t2:[%s] \n", t1, t2);
strcat(t1, "seven");
printf("t1:[%s] t2:[%s] \n", t1, t2);
}
My compiler (Borland 5.5) displayed:
t1:[four] t2:[abcdefghi]
t1:[fourfive] t2:[abcdefghi]
t1:[fourfivesix] t2:[abcdefghi]
t1:[fourfivesixseven] t2:[even]
Notice that the "ixs" has not bled into t2? When setting up a buffer, the compiler starts each variable on a 4 byte boundary. There are a couple bytes between t1 and t2 that are thrown in for ease of processing.
In your case, you didn't overwrite far enough to cause any noticable impact. Try a couple more strcat()'s and you may blow up. I did while testing the above.
Also (something I didn't realize) the variables are defined in reverse order from their declaration.