hurd: Make dl-sysdep __sbrk check __vm_allocate call
authorSamuel Thibault <samuel.thibault@ens-lyon.org>
Mon, 2 Jan 2023 00:49:59 +0000 (01:49 +0100)
committerSamuel Thibault <samuel.thibault@ens-lyon.org>
Mon, 2 Jan 2023 10:36:11 +0000 (11:36 +0100)
The caller won't be able to progress, but better crash than use random
addr.

sysdeps/mach/hurd/dl-sysdep.c

index 2f022ee..84fe966 100644 (file)
@@ -699,7 +699,8 @@ void *weak_function
 __sbrk (intptr_t increment)
 {
   vm_address_t addr;
-  __vm_allocate (__mach_task_self (), &addr, increment, 1);
+  if (__vm_allocate (__mach_task_self (), &addr, increment, 1))
+    return NULL;
   return (void *) addr;
 }