Skip to content

Instantly share code, notes, and snippets.

@mdeous
Created March 30, 2014 14:08
Show Gist options
  • Save mdeous/9873265 to your computer and use it in GitHub Desktop.
Save mdeous/9873265 to your computer and use it in GitHub Desktop.
#include <stdio.h>
#include <stdlib.h>
char username[512] = {1};
void (*_atexit)(int) = exit;
void cp_username(char *name, const char *arg)
{
while((*(name++) = *(arg++)));
*name = 0;
}
int main(int argc, char **argv)
{
if(argc != 2)
{
printf("[-] Usage : %s <username>\n", argv[0]);
exit(0);
}
cp_username(username, argv[1]);
printf("[+] Running program with username : %s\n", username);
_atexit(0);
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment