malloc: Assure that THP mode is always null terminated
authorAdhemerval Zanella <adhemerval.zanella@linaro.org>
Wed, 12 Apr 2023 12:36:54 +0000 (09:36 -0300)
committerAdhemerval Zanella <adhemerval.zanella@linaro.org>
Thu, 13 Apr 2023 20:18:04 +0000 (17:18 -0300)
sysdeps/unix/sysv/linux/malloc-hugepages.c

index 683d68c3275fdff7b36ad0288f16acb6d19786e4..740027ebfb0539ba24e6e686af63fec67f39a85f 100644 (file)
@@ -61,6 +61,7 @@ __malloc_thp_mode (void)
 
   char str[sizeof(mode_always)];
   ssize_t s = __read_nocancel (fd, str, sizeof (str));
+  str[s] = '\0';
   __close_nocancel (fd);
 
   if (s == sizeof (mode_always) - 1)