diff mbox series

[hurd,commited,5/7] hurd: Make dl-sysdep __sbrk check __vm_allocate call

Message ID 20230102100938.2778311-6-samuel.thibault@ens-lyon.org
State New
Headers show
Series hurd: fixes | expand

Commit Message

Samuel Thibault Jan. 2, 2023, 10:09 a.m. UTC
The caller won't be able to progress, but better crash than use random
addr.
---
 sysdeps/mach/hurd/dl-sysdep.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/sysdeps/mach/hurd/dl-sysdep.c b/sysdeps/mach/hurd/dl-sysdep.c
index 2f022ee90c..84fe966efe 100644
--- a/sysdeps/mach/hurd/dl-sysdep.c
+++ b/sysdeps/mach/hurd/dl-sysdep.c
@@ -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;
 }