Welcome to mirror list, hosted at ThFree Co, Russian Federation.

test_setenv_leak.c « scripts - git.busybox.net/busybox.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: e51722ca70aac3d0082d26848b3b6ced6d7f786b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
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;
}