summaryrefslogtreecommitdiff
path: root/other/shellkit/tmp/hpux-tools/sample-one/vuln.c
diff options
context:
space:
mode:
authorRoot THC2026-02-24 12:42:47 +0000
committerRoot THC2026-02-24 12:42:47 +0000
commitc9cbeced5b3f2bdd7407e29c0811e65954132540 (patch)
treeaefc355416b561111819de159ccbd86c3004cf88 /other/shellkit/tmp/hpux-tools/sample-one/vuln.c
parent073fe4bf9fca6bf40cef2886d75df832ef4b6fca (diff)
initial
Diffstat (limited to 'other/shellkit/tmp/hpux-tools/sample-one/vuln.c')
-rw-r--r--other/shellkit/tmp/hpux-tools/sample-one/vuln.c34
1 files changed, 34 insertions, 0 deletions
diff --git a/other/shellkit/tmp/hpux-tools/sample-one/vuln.c b/other/shellkit/tmp/hpux-tools/sample-one/vuln.c
new file mode 100644
index 0000000..698af76
--- /dev/null
+++ b/other/shellkit/tmp/hpux-tools/sample-one/vuln.c
@@ -0,0 +1,34 @@
1/*
2 * Sample vulnerable program for HP-UX buffer overflows case study
3 */
4#include <stdio.h>
5#include <stdlib.h>
6
7
8unsigned long get_sp(void)
9{
10 __asm__("copy %sp,%ret0 \n");
11}
12
13void baz(char *argument) {
14 char badbuf[200];
15
16 printf("badbuf ptr is: %p\n",badbuf);
17 strcpy(badbuf,argument);
18}
19
20void foo(char *arg) {
21
22 baz(arg);
23
24}
25
26int main(int argc, char **argv) {
27char *param;
28
29printf("vuln stack is: 0x%X\n",get_sp());
30param=getenv("VULNBUF");
31foo(param);
32
33return 0;
34}