aboutsummaryrefslogtreecommitdiff
path: root/sysdeps
diff options
context:
space:
mode:
authorAdhemerval Zanella <adhemerval.zanella@linaro.org>2023-04-12 09:36:54 -0300
committerAdhemerval Zanella <adhemerval.zanella@linaro.org>2023-04-13 17:18:04 -0300
commit801deb07f6ecc6a3c8933cffc23d4b3a895259e1 (patch)
treec3e46a7511210fbc1530dd64c0de19195d94810f /sysdeps
parentdecf02d3825daecb95ee293f7b830c4c0cbd1cc5 (diff)
downloadglibc-801deb07f6ecc6a3c8933cffc23d4b3a895259e1.tar
glibc-801deb07f6ecc6a3c8933cffc23d4b3a895259e1.tar.gz
glibc-801deb07f6ecc6a3c8933cffc23d4b3a895259e1.tar.bz2
glibc-801deb07f6ecc6a3c8933cffc23d4b3a895259e1.zip
malloc: Assure that THP mode is always null terminated
Diffstat (limited to 'sysdeps')
-rw-r--r--sysdeps/unix/sysv/linux/malloc-hugepages.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/sysdeps/unix/sysv/linux/malloc-hugepages.c b/sysdeps/unix/sysv/linux/malloc-hugepages.c
index 683d68c327..740027ebfb 100644
--- a/sysdeps/unix/sysv/linux/malloc-hugepages.c
+++ b/sysdeps/unix/sysv/linux/malloc-hugepages.c
@@ -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)