Reverse Engineering challenge #53.

Tags: WINDOWS LINUX L1 .

This code, compiled in Linux x86-64 using GCC is crashing while execution (segmentation fault). It's also crashed if compiled by MinGW for win32. However, it works in Windows environment if compiled by MSVC 2010 x86. Why?


#include <string.h>
#include <stdio.h>

void alter_string(char *s)
{
        strcpy (s, "Goodbye!");
        printf ("Result: %s\n", s);
};

int main()
{
        alter_string ("Hello, world!\n");
};

Thanks to Sourav Punoriyar for note about MinGW.

More challenges: challenges.re; about solutions: challenges.re/#Solutions.