summaryrefslogtreecommitdiffstats
path: root/lib/libc
diff options
context:
space:
mode:
authortobias <tobias@openbsd.org>2015-10-16 16:54:38 +0000
committertobias <tobias@openbsd.org>2015-10-16 16:54:38 +0000
commit1b9417bb627d90cee2fed3f82e34d8d0524f485b (patch)
tree95f54d9f7ec4f290f4467c183a7eea397583bae3 /lib/libc
parentPledge the syslogd privsep process with "stdio rpath wpath cpath (diff)
downloadwireguard-openbsd-1b9417bb627d90cee2fed3f82e34d8d0524f485b.tar.xz
wireguard-openbsd-1b9417bb627d90cee2fed3f82e34d8d0524f485b.zip
Check file sizes only for regular files. The current code breaks savecore
due to its kvm handling. ok deraadt
Diffstat (limited to 'lib/libc')
-rw-r--r--lib/libc/gen/nlist.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/libc/gen/nlist.c b/lib/libc/gen/nlist.c
index 437640732d1..f76543bf8fd 100644
--- a/lib/libc/gen/nlist.c
+++ b/lib/libc/gen/nlist.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: nlist.c,v 1.64 2015/10/16 13:54:45 tobias Exp $ */
+/* $OpenBSD: nlist.c,v 1.65 2015/10/16 16:54:38 tobias Exp $ */
/*
* Copyright (c) 1989, 1993
* The Regents of the University of California. All rights reserved.
@@ -107,7 +107,7 @@ __fdnlist(int fd, struct nlist *list)
/* Make sure it's not too big to mmap */
if (SIZE_MAX - ehdr.e_shoff < shdr_size ||
- ehdr.e_shoff + shdr_size > st.st_size) {
+ (S_ISREG(st.st_mode) && ehdr.e_shoff + shdr_size > st.st_size)) {
errno = EFBIG;
return (-1);
}
@@ -177,7 +177,7 @@ __fdnlist(int fd, struct nlist *list)
/* Check for files too large to mmap. */
if (SIZE_MAX - symstrsize < symstroff ||
- symstrsize + symstroff > st.st_size) {
+ (S_ISREG(st.st_mode) && symstrsize + symstroff > st.st_size)) {
errno = EFBIG;
return (-1);
}