aboutsummaryrefslogtreecommitdiff
path: root/overflow.c
blob: de2a1abd638e43ad6f55a96c237332103a5a1727 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
/*
 * overflow.c
 *
 *  Created on: 27.01.2012
 *      Author: druid
 */

#include <stdlib.h>
#include <stdio.h>
#include <string.h>

#define ENV_VAR   "EXPLOIT"
#define BUFLEN    256

u_char buf[BUFLEN];
u_char *env;

int
main()
{
  if (env = getenv(ENV_VAR))
    {
      fprintf(stderr, "env: "ENV_VAR" set\n");
      fprintf(stderr, "env: %s\n", env);

      strcpy(buf, env);
    }
  else
    {
      fprintf(stderr, "env: "ENV_VAR" not set, abort!\n");
    }

  return 0;
}