I've been programming for an application and unfortunately, I've found a bug while the application was in production.
The bug was a stack corruption bug.
Anyways, it seems that the code I've developed on my box didn't crash although while in production it did.
So why did this happen?
I even changed the stack size (feeling that it could be related), using ulimit (using PAM - limits.conf), on my development box to the values of the production one. And still it wasn't enough to trigger the bug.
The bug is something like:
I know that I can't pass local variables to other functions.Code:
int my_function2(int pc, char **plist)
return 0; /* It doesn't really matter. */
int my_function1(int pc, char **plist)
this_plist = plist;
this_plist = "I_changed_this";
this_plist = NULL;
So, a) why is this sort of bug not crashing on one machine and is on another? and b) any comments / suggestions that you may share with me on how to avoid this? (I know I can use static variables and dynamic allocations.)
Thanks in advance.