diff options
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/test_setenv_leak.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/scripts/test_setenv_leak.c b/scripts/test_setenv_leak.c new file mode 100644 index 000000000..e51722ca7 --- /dev/null +++ b/scripts/test_setenv_leak.c @@ -0,0 +1,18 @@ +#include <stdio.h> +#include <stdlib.h> +#include <unistd.h> +int main(int argc, char **argv) +{ + char buf[256]; + + int i = argv[1] ? atoi(argv[1]) : 999999; + while (--i > 0) { + sprintf(buf, "%d", i); + setenv("VAR", buf, 1); + } + printf("Check size of [heap] mapping:\n"); + freopen("/proc/self/maps", "r", stdin); + while (fgets(buf, sizeof(buf), stdin)) + fputs(buf, stdout); + return 0; +} |