summaryrefslogtreecommitdiffstats
path: root/lib/libc/stdio/makebuf.c
diff options
context:
space:
mode:
authordhartmei <dhartmei@openbsd.org>2002-09-14 22:03:14 +0000
committerdhartmei <dhartmei@openbsd.org>2002-09-14 22:03:14 +0000
commit8d62ee40dc28d335867f292dd8aab66f53e20b5b (patch)
treead54f039e1d7d49a8f9d2f8fe09f8b447e2e743f /lib/libc/stdio/makebuf.c
parentrecognize AppleKiwi (diff)
downloadwireguard-openbsd-8d62ee40dc28d335867f292dd8aab66f53e20b5b.tar.xz
wireguard-openbsd-8d62ee40dc28d335867f292dd8aab66f53e20b5b.zip
Move __cleanup into mprotect'ed page to prevent unintentional modifications
similar to the atexit handlers. Idea and help deraadt@, ok deraadt@
Diffstat (limited to 'lib/libc/stdio/makebuf.c')
-rw-r--r--lib/libc/stdio/makebuf.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/libc/stdio/makebuf.c b/lib/libc/stdio/makebuf.c
index 4ebc3e93362..da9b86ca4ce 100644
--- a/lib/libc/stdio/makebuf.c
+++ b/lib/libc/stdio/makebuf.c
@@ -35,7 +35,7 @@
*/
#if defined(LIBC_SCCS) && !defined(lint)
-static char rcsid[] = "$OpenBSD: makebuf.c,v 1.3 1998/11/25 05:18:49 millert Exp $";
+static char rcsid[] = "$OpenBSD: makebuf.c,v 1.4 2002/09/14 22:03:14 dhartmei Exp $";
#endif /* LIBC_SCCS and not lint */
#include <sys/types.h>
@@ -73,7 +73,7 @@ __smakebuf(fp)
fp->_bf._size = 1;
return;
}
- __cleanup = _cleanup;
+ __atexit_register_cleanup(_cleanup);
flags |= __SMBF;
fp->_bf._base = fp->_p = p;
fp->_bf._size = size;