diff options
author | Miod Vallat <miod@cvs.openbsd.org> | 2003-10-01 18:19:09 +0000 |
---|---|---|
committer | Miod Vallat <miod@cvs.openbsd.org> | 2003-10-01 18:19:09 +0000 |
commit | 84efb8a0b304fe0a702ae15231886051a8e3b232 (patch) | |
tree | 35f286905d2008a20e9c14a3b3ccf057661a12a5 /lib/libc/sys/stack_protector.c | |
parent | 80f0cde35cb1355e7c9ebc83a11ed5c19ed02096 (diff) |
Directly invoke the sysctl system call, rather than going through the sysctl(3)
wrapper.
ok deraadt@ millert@
Diffstat (limited to 'lib/libc/sys/stack_protector.c')
-rw-r--r-- | lib/libc/sys/stack_protector.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/libc/sys/stack_protector.c b/lib/libc/sys/stack_protector.c index 9f45343311c..7e6746f7128 100644 --- a/lib/libc/sys/stack_protector.c +++ b/lib/libc/sys/stack_protector.c @@ -1,4 +1,4 @@ -/* $OpenBSD: stack_protector.c,v 1.5 2003/07/18 23:05:13 david Exp $ */ +/* $OpenBSD: stack_protector.c,v 1.6 2003/10/01 18:19:08 miod Exp $ */ /* * Copyright (c) 2002 Hiroaki Etoh, Federico G. Schwindt, and Miodrag Vallat. @@ -28,7 +28,7 @@ */ #if defined(LIBC_SCCS) && !defined(list) -static char rcsid[] = "$OpenBSD: stack_protector.c,v 1.5 2003/07/18 23:05:13 david Exp $"; +static char rcsid[] = "$OpenBSD: stack_protector.c,v 1.6 2003/10/01 18:19:08 miod Exp $"; #endif #include <sys/param.h> @@ -38,6 +38,8 @@ static char rcsid[] = "$OpenBSD: stack_protector.c,v 1.5 2003/07/18 23:05:13 dav #include <syslog.h> #include <unistd.h> +extern int __sysctl(int *, u_int, void *, size_t *, void *, size_t); + long __guard[8] = {0, 0, 0, 0, 0, 0, 0, 0}; static void __guard_setup(void) __attribute__ ((constructor)); void __stack_smash_handler(char func[], int damaged __attribute__((unused))); @@ -56,7 +58,7 @@ __guard_setup(void) len = 4; for (i = 0; i < sizeof(__guard) / 4; i++) { - if (sysctl(mib, 2, (char *)&((int *)__guard)[i], + if (__sysctl(mib, 2, (char *)&((int *)__guard)[i], &len, NULL, 0) == -1) break; } |