Skip to content

Instantly share code, notes, and snippets.

@shri-kanth
Created January 8, 2022 03:47
Show Gist options
  • Save shri-kanth/7b21d94fce5d328540c3a8e638fec1da to your computer and use it in GitHub Desktop.
Save shri-kanth/7b21d94fce5d328540c3a8e638fec1da to your computer and use it in GitHub Desktop.
#include <stdlib.h>
#include <unistd.h>
#include <stdio.h>
#include <string.h>
#define SIZE 64
void vuln(char *string)
{
if(strlen(string) < SIZE) {
int target = 0;
char buffer[SIZE];
sprintf(buffer, string);
if(target == 1330794330) {
printf("You Win! :)\n");
return;
}
}
printf("Better Luck Next Time :P\n");
}
int main(int argc, char **argv)
{
vuln(argv[1]);
}
@shri-kanth
Copy link
Author

32-bit : gcc -g formatZero.c -o formatZero_32 -m32 -fno-stack-protector
64-bit : gcc -g formatZero.c -o formatZero_64 -fno-stack-protector

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment