public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Eric Sandeen <sandeen@sandeen.net>
To: Eric Sandeen <sandeen@redhat.com>, xfs-oss <xfs@oss.sgi.com>
Subject: [PATCH 1/3] xfs_fsr: ensure the line we read from leftofffile is null terminated
Date: Fri, 06 Jun 2014 16:03:10 -0500	[thread overview]
Message-ID: <53922C8E.3050700@sandeen.net> (raw)
In-Reply-To: <53922B49.1050005@redhat.com>

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

  reply	other threads:[~2014-06-06 21:03 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 ` Eric Sandeen [this message]
2014-06-09 13:02   ` [PATCH 1/3] xfs_fsr: ensure the line we read from leftofffile is null terminated Brian Foster
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=53922C8E.3050700@sandeen.net \
    --to=sandeen@sandeen.net \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox