Created
May 5, 2013 01:04
-
-
Save awreece/5519313 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ cat print_buf.c | |
#include <stdio.h> | |
int main(int argc, char** argv, char** envp) { | |
char buf[100]; | |
printf("Stack at %p\n", buf); | |
int i; | |
for (i = 0; envp[i]; i++) { | |
printf("%p: %s\n", envp[i], envp[i]); | |
} | |
} | |
$ env -i ./a.out howdy_bro | |
Stack at 0xffffddf8 | |
$ env -i gdb -q ./a.out | |
Reading symbols from /home/ppp/a.out...(no debugging symbols found)...done. | |
(gdb) show environment | |
LINES=24 | |
COLUMNS=84 | |
(gdb) unset environment LINES | |
(gdb) unset environment COLUMNS | |
(gdb) r howdy_bro | |
Starting program: /home/ppp/a.out howdy_bro | |
Stack at 0xffffddc8 | |
0xffffdfd2: PWD=/home/ppp | |
0xffffdfe0: SHLVL=0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment