about summary refs log tree commit diff
path: root/sysdeps/unix
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps/unix')
-rw-r--r--sysdeps/unix/sysv/linux/malloc-hugepages.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/sysdeps/unix/sysv/linux/malloc-hugepages.c b/sysdeps/unix/sysv/linux/malloc-hugepages.c
index 740027ebfb..2f316474c1 100644
--- a/sysdeps/unix/sysv/linux/malloc-hugepages.c
+++ b/sysdeps/unix/sysv/linux/malloc-hugepages.c
@@ -61,6 +61,8 @@ __malloc_thp_mode (void)
 
   char str[sizeof(mode_always)];
   ssize_t s = __read_nocancel (fd, str, sizeof (str));
+  if (s >= sizeof str || s < 0)
+    return malloc_thp_mode_not_supported;
   str[s] = '\0';
   __close_nocancel (fd);