public inbox for glibc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Adhemerval Zanella <adhemerval.zanella@linaro.org>
To: Andreas Schwab <schwab@linux-m68k.org>
Cc: Adhemerval Zanella via Glibc-cvs <glibc-cvs@sourceware.org>,
	Adhemerval Zanella <azanella@sourceware.org>
Subject: Re: [glibc] malloc: Assure that THP mode is always null terminated
Date: Fri, 14 Apr 2023 08:02:07 -0300	[thread overview]
Message-ID: <AD76C6CB-A977-445F-852D-6F95973F2C6E@linaro.org> (raw)
In-Reply-To: <87fs93lzuj.fsf@linux-m68k.org>



> On 14 Apr 2023, at 03:52, Andreas Schwab <schwab@linux-m68k.org> wrote:
> 
> On Apr 13 2023, Adhemerval Zanella via Glibc-cvs wrote:
> 
>> 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';
> 
> This is a buffer overflow if s >= sizeof (str) or s < 0.

Indeed, thanks for catching it. I will fix it.

      reply	other threads:[~2023-04-14 11:02 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-13 20:18 Adhemerval Zanella
2023-04-14  6:52 ` Andreas Schwab
2023-04-14 11:02   ` Adhemerval Zanella [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=AD76C6CB-A977-445F-852D-6F95973F2C6E@linaro.org \
    --to=adhemerval.zanella@linaro.org \
    --cc=azanella@sourceware.org \
    --cc=glibc-cvs@sourceware.org \
    --cc=schwab@linux-m68k.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).