Created attachment 11041 [details] Binary for the source code I didn't compile the binary myself. It has no stack protections #include <stdlib.h> #include <unistd.h> #include <stdio.h> int main(int argc, char **argv) { volatile int modified; char buffer[64]; modified = 0; gets(buffer); if(modified != 0) { printf("you have changed the 'modified' variable\n"); } else { printf("Try again?\n"); } } The addresses of modified and buffer are printed above argv, which is nonsense. Also their true location is different, as evidenced by what strcpy modifies. print &modified $1 = (volatile int*) 0xffffcf3c print &argv $2 = (char***) 0xffffcf64
*** Bug 23221 has been marked as a duplicate of this bug. ***
*** Bug 23222 has been marked as a duplicate of this bug. ***
*** Bug 23223 has been marked as a duplicate of this bug. ***
*** Bug 23224 has been marked as a duplicate of this bug. ***
*** Bug 23225 has been marked as a duplicate of this bug. ***
This executable was compiled using the stabs debug format. stabs is long since deprecated. It may work sometimes, but as you've found, there are bugs -- some of which, I believe, are what lead the world to abandon stabs in favor of DWARF. I don't know stabs well enough (they were deprecated before I started working on gdb, which is quite a long time ago now) to even say whether you've hit one of these. The fix is to not use stabs but instead use DWARF. This is the default in all contemporary free software compilers, and has been for a decade or more. I tend to think we should "wontfix" stabs bugs, since that reflects the real situation -- nobody works on stabs at all, I don't recall the last time a bug was fixed there. However, that always seems a little rude somehow in bugzilla.