1.1 Trouver l'adresse d'une variable d'environnement (Unix)

De UnixWiki
Aller à : navigation, rechercher
 // getenvaddress.c
 // thanks Niklos !!
 // usage: inject 'NOMDELAVARIABLEDENVIRONNEMENT'
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
int main(int argc, char **argv) { char *ptr; ptr = getenv(argv[1]);
if( ptr == NULL ) printf("%s not found\n", argv[1]); else printf("%s found at %08x\n", argv[1], (unsigned int)ptr);
return 0; }