aboutsummaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorRon Yorston <rmy@pobox.com>2017-07-24 11:40:28 +0100
committerRon Yorston <rmy@pobox.com>2017-07-24 12:03:28 +0100
commit60411636073cdc08e8005f0de00098e6dd00eaf5 (patch)
tree58673b64af1e663280be81f798c8f66ce116d1dd /scripts
parenteeceafbc5c4caf513c6d92b7d71ecb0ccd89a3f8 (diff)
parentb72f1ef17b97802d33f0ac522f64bea0f65442c5 (diff)
downloadbusybox-w32-60411636073cdc08e8005f0de00098e6dd00eaf5.tar.gz
busybox-w32-60411636073cdc08e8005f0de00098e6dd00eaf5.tar.bz2
busybox-w32-60411636073cdc08e8005f0de00098e6dd00eaf5.zip
Merge branch 'busybox' into merge
Diffstat (limited to 'scripts')
-rw-r--r--scripts/test_setenv_leak.c18
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 @@
1#include <stdio.h>
2#include <stdlib.h>
3#include <unistd.h>
4int main(int argc, char **argv)
5{
6 char buf[256];
7
8 int i = argv[1] ? atoi(argv[1]) : 999999;
9 while (--i > 0) {
10 sprintf(buf, "%d", i);
11 setenv("VAR", buf, 1);
12 }
13 printf("Check size of [heap] mapping:\n");
14 freopen("/proc/self/maps", "r", stdin);
15 while (fgets(buf, sizeof(buf), stdin))
16 fputs(buf, stdout);
17 return 0;
18}