summaryrefslogtreecommitdiff
path: root/usr.sbin
diff options
context:
space:
mode:
authorTobias Stoeckmann <tobias@cvs.openbsd.org>2015-10-16 16:54:39 +0000
committerTobias Stoeckmann <tobias@cvs.openbsd.org>2015-10-16 16:54:39 +0000
commitc63e7a592c2bade541347c9afcaab4553c88a365 (patch)
treeddb1288ef43289b6f343a2a1e12d536d0a24ef86 /usr.sbin
parent1ee57807771d6f013365c131d8da16bb6e624592 (diff)
Check file sizes only for regular files. The current code breaks savecore
due to its kvm handling. ok deraadt
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/installboot/i386_nlist.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/usr.sbin/installboot/i386_nlist.c b/usr.sbin/installboot/i386_nlist.c
index 9d5950dcbf7..c5a32055f7e 100644
--- a/usr.sbin/installboot/i386_nlist.c
+++ b/usr.sbin/installboot/i386_nlist.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: i386_nlist.c,v 1.3 2015/10/16 13:54:45 tobias Exp $ */
+/* $OpenBSD: i386_nlist.c,v 1.4 2015/10/16 16:54:38 tobias Exp $ */
/*
* Copyright (c) 1989, 1993
* The Regents of the University of California. All rights reserved.
@@ -117,7 +117,7 @@ __elf_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);
}
@@ -187,7 +187,7 @@ __elf_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);
}