diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 2003-02-28 18:05:52 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 2003-02-28 18:05:52 +0000 |
commit | c4ab57aad282b1af1cfaea168eba167c9265c587 (patch) | |
tree | 0b2f4bad1ef790abf5fdd09a6632393fd4ed9524 /lib/csu/vax/crt0.c | |
parent | 1e988d2ffc39487d5063a70a1f09e5c4bdad7918 (diff) |
copy basename of argv[0] to bss for __progname, so that large stack smash
does not make propolice reporting ineffective; millert miod ok
Diffstat (limited to 'lib/csu/vax/crt0.c')
-rw-r--r-- | lib/csu/vax/crt0.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/lib/csu/vax/crt0.c b/lib/csu/vax/crt0.c index 9881dbb69f2..47db33744ed 100644 --- a/lib/csu/vax/crt0.c +++ b/lib/csu/vax/crt0.c @@ -1,4 +1,4 @@ -/* $OpenBSD: crt0.c,v 1.7 2002/09/17 21:16:01 deraadt Exp $ */ +/* $OpenBSD: crt0.c,v 1.8 2003/02/28 18:05:51 deraadt Exp $ */ /* $NetBSD: crt0.c,v 1.1.2.1 1995/10/15 19:40:04 ragge Exp $ */ /* * Copyright (c) 1993 Paul Kranenburg @@ -33,7 +33,7 @@ #if defined(LIBC_SCCS) && !defined(lint) -static char rcsid[] = "$OpenBSD: crt0.c,v 1.7 2002/09/17 21:16:01 deraadt Exp $"; +static char rcsid[] = "$OpenBSD: crt0.c,v 1.8 2003/02/28 18:05:51 deraadt Exp $"; #endif /* LIBC_SCCS and not lint */ #include <sys/param.h> @@ -57,6 +57,7 @@ start() */ register struct kframe *kfp; register char **argv, *ap; + char *s; #ifdef lint kfp = 0; @@ -68,11 +69,17 @@ start() argv = &kfp->kargv[0]; environ = argv + kfp->kargc + 1; - if (ap = argv[0]) + if (ap = argv[0]) { if ((__progname = _strrchr(ap, '/')) == NULL) __progname = ap; else ++__progname; + for (s = __progname_storage; *__progname && + s < &__progname_storage[sizeof __progname_storage - 1]; ) + *s++ = *__progname++; + *s = '\0'; + __progname = __progname_storage; + } #ifdef DYNAMIC /* ld(1) convention: if DYNAMIC = 0 then statically linked */ |