Skip to content

Instantly share code, notes, and snippets.

@AndyNovo
Created November 30, 2016 15:29
Show Gist options
  • Save AndyNovo/2005c8acab75158ef1e3a6ccbd9a1e19 to your computer and use it in GitHub Desktop.
Save AndyNovo/2005c8acab75158ef1e3a6ccbd9a1e19 to your computer and use it in GitHub Desktop.
#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