public inbox for glibc-cvs@sourceware.org
help / color / mirror / Atom feed
* [glibc] malloc: Assure that THP mode read do write OOB end of stringt
@ 2023-04-14 11:28 Adhemerval Zanella
  0 siblings, 0 replies; only message in thread
From: Adhemerval Zanella @ 2023-04-14 11:28 UTC (permalink / raw)
  To: glibc-cvs

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=05fe3ecffff485032e904f0a3ea709e24d9188eb

commit 05fe3ecffff485032e904f0a3ea709e24d9188eb
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date:   Fri Apr 14 08:22:40 2023 -0300

    malloc: Assure that THP mode read do write OOB end of stringt

Diff:
---
 sysdeps/unix/sysv/linux/malloc-hugepages.c | 2 ++
 1 file changed, 2 insertions(+)

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);

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2023-04-14 11:28 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-04-14 11:28 [glibc] malloc: Assure that THP mode read do write OOB end of stringt Adhemerval Zanella

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).