linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Richard Weinberger <richard@nod.at>
To: Andreas Dilger <adilger@dilger.ca>
Cc: tytso <tytso@mit.edu>, linux-ext4 <linux-ext4@vger.kernel.org>,
	linux-kernel <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] ext4: Don't leak old mountpoint samples
Date: Thu, 17 Dec 2020 22:15:24 +0100 (CET)	[thread overview]
Message-ID: <1954206563.139982.1608239724384.JavaMail.zimbra@nod.at> (raw)
In-Reply-To: <CA1BD917-22BD-4AAD-877D-BDF41B36D945@dilger.ca>

----- Ursprüngliche Mail -----
>>    Fix this by using strncpy() instead of strlcpy().  The superblock
>>    field is defined to be a fixed-size char array, and it is already
>>    marked using __nonstring in fs/ext4/ext4.h.  The consumer of the field
>>    in e2fsprogs already assumes that in the case of a 64+ byte mount
>>    path, that s_last_mounted will not be NUL terminated.
>> 
>>    Reported-by: Richard Weinberger <richard@nod.at>
>>    Signed-off-by: Theodore Ts'o <tytso@mit.edu>
> 
> Color me confused, but I don't see how this change makes any difference?
> If "cp" is only "/" then it will *still* not overwrite "edia/johnjdeveloper"
> at the end of the s_last_mounted array.  To my mind, the only difference
> between using strlcpy() and strncpy() would be whether the last byte in
> the array can be used or not, but doesn't affect the remaining bytes.

strncpy() zeros all remaining bytes.

Thanks,
//richard

      reply	other threads:[~2020-12-17 21:16 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-01 15:13 [PATCH] ext4: Don't leak old mountpoint samples Richard Weinberger
2020-12-09 23:24 ` harshad shirwadkar
2020-12-17 18:27 ` Theodore Y. Ts'o
2020-12-17 21:09   ` Andreas Dilger
2020-12-17 21:15     ` Richard Weinberger [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=1954206563.139982.1608239724384.JavaMail.zimbra@nod.at \
    --to=richard@nod.at \
    --cc=adilger@dilger.ca \
    --cc=linux-ext4@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tytso@mit.edu \
    /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 NNTP newsgroup(s).