summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiod Vallat <miod@cvs.openbsd.org>2012-04-16 19:40:02 +0000
committerMiod Vallat <miod@cvs.openbsd.org>2012-04-16 19:40:02 +0000
commit3fbd81f6ddbd37af8671b6d657343acafaae685d (patch)
tree365e3105f0755dd17978e59afee8c25082240e48
parent74f5554958854b96ce7781b95e769e9916b77cf4 (diff)
Don't attempt to mmap 0-length bss.
-rw-r--r--gnu/usr.bin/ld/rtld/rtld.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/gnu/usr.bin/ld/rtld/rtld.c b/gnu/usr.bin/ld/rtld/rtld.c
index e4ed556d508..f2708757304 100644
--- a/gnu/usr.bin/ld/rtld/rtld.c
+++ b/gnu/usr.bin/ld/rtld/rtld.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rtld.c,v 1.41 2005/12/21 01:40:22 millert Exp $ */
+/* $OpenBSD: rtld.c,v 1.42 2012/04/16 19:40:01 miod Exp $ */
/* $NetBSD: rtld.c,v 1.43 1996/01/14 00:35:17 pk Exp $ */
/*
* Copyright (c) 1993 Paul Kranenburg
@@ -696,7 +696,7 @@ again:
return NULL;
}
- if (mmap(addr + hdr.a_text + hdr.a_data, hdr.a_bss,
+ if (hdr.a_bss && mmap(addr + hdr.a_text + hdr.a_data, hdr.a_bss,
PROT_READ|PROT_WRITE,
MAP_ANON|MAP_COPY|MAP_FIXED,
anon_fd, 0) == (caddr_t)MAP_FAILED) {