Created
November 30, 2016 15:29
-
-
Save AndyNovo/2005c8acab75158ef1e3a6ccbd9a1e19 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "stdio.h" | |
#include "string.h" | |
int main(int argc, char **argv) | |
{ | |
char text[1024]; | |
static int some_value = -72; | |
strcpy(text, argv[1]); /* ignore the buffer overflow here */ | |
printf("This is how you print correctly:\n"); | |
printf("%s", text); | |
printf("This is how not to print:\n"); | |
printf(text); | |
printf("some_value @ 0x%08x = %d [0x%08x]", &some_value, some_value, some_value); | |
return(0); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment