Skip to content

Instantly share code, notes, and snippets.

@flaneur2020
Created March 10, 2013 05:37
Show Gist options
  • Select an option

  • Save flaneur2020/5127269 to your computer and use it in GitHub Desktop.

Select an option

Save flaneur2020/5127269 to your computer and use it in GitHub Desktop.
level2@io:/levels$ cat level02.c
//a little fun brought to you by bla
#include <stdio.h>
#include <stdlib.h>
#include <signal.h>
#include <setjmp.h>
void catcher(int a)
{
setresuid(geteuid(),geteuid(),geteuid());
printf("WIN!\n");
system("/bin/sh");
exit(0);
}
int main(int argc, char **argv)
{
puts("source code is available in level02.c\n");
if (argc != 3 || !atoi(argv[2]))
return 1;
signal(SIGFPE, catcher);
return abs(atoi(argv[1])) / atoi(argv[2]);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment