aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSamuel Thibault <samuel.thibault@ens-lyon.org>2014-04-16 23:16:15 +0200
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2014-04-16 23:16:15 +0200
commitfd15a59b20220a2d89d628ecebfcaad1ddefe871 (patch)
tree4b5f1de23e83a02f4c5c5b39701cad55267e43e8
parentf19dfa0afd3879cb09e9c6efd7df58e1ee02c029 (diff)
downloadglibc-fd15a59b20220a2d89d628ecebfcaad1ddefe871.tar
glibc-fd15a59b20220a2d89d628ecebfcaad1ddefe871.tar.gz
glibc-fd15a59b20220a2d89d628ecebfcaad1ddefe871.tar.bz2
glibc-fd15a59b20220a2d89d628ecebfcaad1ddefe871.zip
hurd: Do not allow unmapping address 0
* sysdeps/mach/munmap.c (__munmap): Return EINVAL if `addr' is 0.
-rw-r--r--ChangeLog4
-rw-r--r--sysdeps/mach/munmap.c7
2 files changed, 11 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index ea70b2859d..970dedb45a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2014-04-16 Samuel Thibault <samuel.thibault@ens-lyon.org>
+
+ * sysdeps/mach/munmap.c (__munmap): Return EINVAL if `addr' is 0.
+
2014-04-16 Stefan Liebler <stli@linux.vnet.ibm.com>
* sysdeps/s390/fpu/libm-test-ulps: Regenerate.
diff --git a/sysdeps/mach/munmap.c b/sysdeps/mach/munmap.c
index f8c416f76f..cfd5daa3c1 100644
--- a/sysdeps/mach/munmap.c
+++ b/sysdeps/mach/munmap.c
@@ -27,6 +27,13 @@ int
__munmap (__ptr_t addr, size_t len)
{
kern_return_t err;
+
+ if (addr == 0)
+ {
+ errno = EINVAL;
+ return -1;
+ }
+
if (err = __vm_deallocate (__mach_task_self (),
(vm_address_t) addr, (vm_size_t) len))
{