From: Brian Foster <bfoster@redhat.com>
To: Eric Sandeen <sandeen@sandeen.net>
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, 9 Jun 2014 09:02:36 -0400 [thread overview]
Message-ID: <20140609130235.GA31319@bfoster.bfoster> (raw)
In-Reply-To: <53922C8E.3050700@sandeen.net>
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..?
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 13:02 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 [this message]
2014-06-09 14:01 ` Eric Sandeen
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=20140609130235.GA31319@bfoster.bfoster \
--to=bfoster@redhat.com \
--cc=sandeen@redhat.com \
--cc=sandeen@sandeen.net \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox