From: Eric Sandeen <sandeen@sandeen.net>
To: Brian Foster <bfoster@redhat.com>
Cc: Eric Sandeen <sandeen@redhat.com>, xfs-oss <xfs@oss.sgi.com>
Subject: Re: [PATCH 1/3] xfs_fsr: ensure the line we read from leftofffile is null terminated
Date: Mon, 09 Jun 2014 09:01:22 -0500 [thread overview]
Message-ID: <5395BE32.3080204@sandeen.net> (raw)
In-Reply-To: <20140609130235.GA31319@bfoster.bfoster>
On 6/9/14, 8:02 AM, Brian Foster wrote:
> On Fri, Jun 06, 2014 at 04:03:10PM -0500, Eric Sandeen wrote:
>> Ensure that the string we read from leftofffile is NULL
>> terminated; the buffer gets passed to strchr(), so
>> it's important that we ensure it ends with NULL.
>>
>> Signed-off-by: Eric Sandeen <sandeen@redhat.com>
>> ---
>>
>> diff --git a/fsr/xfs_fsr.c b/fsr/xfs_fsr.c
>> index 3818f02..94d235c 100644
>> --- a/fsr/xfs_fsr.c
>> +++ b/fsr/xfs_fsr.c
>> @@ -554,6 +554,8 @@ fsrallfs(char *mtab, int howlong, char *leftofffile)
>> fsrprintf(_("could not read %s, starting with %s\n"),
>> leftofffile, *fs->dev);
>> } else {
>> + /* Ensure the buffer we read is null terminated */
>> + buf[SMBUFSZ-1] = '\0';
>
> Maybe just initialize the buffer..?
and then read no more than SMBUFSZ-1... I dunno, 6 one way, half a dozen
the other?
-Eric
> Brian
>
>> for (fs = fsbase; fs < fsend; fs++) {
>> fsname = fs->dev;
>> if ((strncmp(buf,fsname,strlen(fsname)) == 0)
>>
>> _______________________________________________
>> xfs mailing list
>> xfs@oss.sgi.com
>> http://oss.sgi.com/mailman/listinfo/xfs
>
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
next prev parent reply other threads:[~2014-06-09 14:01 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-06-06 20:57 [PATCH 0/3] xfs_fsr robustification Eric Sandeen
2014-06-06 21:03 ` [PATCH 1/3] xfs_fsr: ensure the line we read from leftofffile is null terminated Eric Sandeen
2014-06-09 13:02 ` Brian Foster
2014-06-09 14:01 ` Eric Sandeen [this message]
2014-06-09 14:29 ` Mark Tinguely
2014-06-06 21:04 ` [PATCH 2/3] xfs_fsr: create a cleanup/return target in packfile() Eric Sandeen
2014-06-09 13:02 ` Brian Foster
2014-06-06 21:06 ` [PATCH 3/3] xfs_fsr: test for more potential failures " Eric Sandeen
2014-06-09 13:02 ` Brian Foster
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=5395BE32.3080204@sandeen.net \
--to=sandeen@sandeen.net \
--cc=bfoster@redhat.com \
--cc=sandeen@redhat.com \
--cc=xfs@oss.sgi.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.