| To: | Eric Sandeen <sandeen@xxxxxxxxxxx> |
|---|---|
| Subject: | Re: [PATCH 1/3] xfs_fsr: ensure the line we read from leftofffile is null terminated |
| From: | Brian Foster <bfoster@xxxxxxxxxx> |
| Date: | Mon, 9 Jun 2014 09:02:36 -0400 |
| Cc: | Eric Sandeen <sandeen@xxxxxxxxxx>, xfs-oss <xfs@xxxxxxxxxxx> |
| Delivered-to: | xfs@xxxxxxxxxxx |
| In-reply-to: | <53922C8E.3050700@xxxxxxxxxxx> |
| References: | <53922B49.1050005@xxxxxxxxxx> <53922C8E.3050700@xxxxxxxxxxx> |
| User-agent: | Mutt/1.5.23 (2014-03-12) |
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@xxxxxxxxxx>
> ---
>
> 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@xxxxxxxxxxx
> http://oss.sgi.com/mailman/listinfo/xfs
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| ||
| Previous by Date: | Re: [RFC PATCH 1/1] cleanup: use bool as return type for rwsem_is_locked, Pranith Kumar |
|---|---|
| Next by Date: | Re: [PATCH 2/3] xfs_fsr: create a cleanup/return target in packfile(), Brian Foster |
| Previous by Thread: | [PATCH 1/3] xfs_fsr: ensure the line we read from leftofffile is null terminated, Eric Sandeen |
| Next by Thread: | Re: [PATCH 1/3] xfs_fsr: ensure the line we read from leftofffile is null terminated, Eric Sandeen |
| Indexes: | [Date] [Thread] [Top] [All Lists] |