Skip to content

Instantly share code, notes, and snippets.

@Sasszem
Last active January 28, 2021 01:15
Show Gist options
  • Select an option

  • Save Sasszem/58478d3aaa20e99a476dec09692ec39a to your computer and use it in GitHub Desktop.

Select an option

Save Sasszem/58478d3aaa20e99a476dec09692ec39a to your computer and use it in GitHub Desktop.
Pwn me - do not modify the source, but make it print the "you won" text! Use Linux/WSL!
#include <stdio.h>
int main() {
long admin = 0;
long s;
char name[100];
fprintf(stdout, "\e[41mDEBUG:\e[49m %p\n", &s);
fprintf(stdout, "\e[41mDEBUG:\e[49m %ld %ld\n", sizeof s, sizeof &s);
printf("Whats ur name? ");
scanf("%100s", name);
printf("Hov old r u? ");
scanf("%ld", &s);
printf("Hello, ");
printf(name);
if (admin)
printf("you won!");
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment