Skip to content

Instantly share code, notes, and snippets.

@RdlP
Created October 20, 2016 17:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save RdlP/e31dcafcafee7e1154274639610165ad to your computer and use it in GitHub Desktop.
Save RdlP/e31dcafcafee7e1154274639610165ad to your computer and use it in GitHub Desktop.
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
int main(int argc, char **argv)
{
if (argc < 3){
printf("uso: %s variable_entorno programa_vulnerable\n", argv[0]);
return 0;
}
char *ptr = getenv(argv[1]);
ptr += (strlen(argv[0]) - strlen(argv[2])) * 2;
printf("La variable %s se encuentra en %p\n", argv[1], ptr);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment