due to its kvm handling.
ok deraadt
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
+#include <string.h>
#include <unistd.h>
#include <nlist.h>
/* 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);
}
/* 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);
}
-/* $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.
/* 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);
}
/* 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);
}
-/* $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.
/* 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);
}
/* 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);
}