hurd: Do not allow unmapping address 0
authorSamuel Thibault <samuel.thibault@ens-lyon.org>
Wed, 16 Apr 2014 21:16:15 +0000 (23:16 +0200)
committerSamuel Thibault <samuel.thibault@ens-lyon.org>
Wed, 16 Apr 2014 21:16:15 +0000 (23:16 +0200)
* sysdeps/mach/munmap.c (__munmap): Return EINVAL if `addr' is 0.

ChangeLog
sysdeps/mach/munmap.c

index ea70b28..970dedb 100644 (file)
--- 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.
index f8c416f..cfd5daa 100644 (file)
@@ -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))
     {