From: Miao Xie <miaox@cn.fujitsu.com>
To: Eric Sandeen <sandeen@redhat.com>
Cc: linux-btrfs <linux-btrfs@vger.kernel.org>
Subject: Re: [PATCH] btrfs-progs: don't overrun "answer" array in cmds-chunk.c
Date: Tue, 06 Aug 2013 11:17:06 +0800 [thread overview]
Message-ID: <52006AB2.1080605@cn.fujitsu.com> (raw)
In-Reply-To: <52006509.1060207@redhat.com>
On mon, 05 Aug 2013 21:52:57 -0500, Eric Sandeen wrote:
> If an array is 5 chars in size:
>
> char answer[5];
>
> and we write the 6th char (counting from 0)...
>
> answer[5] = '\0';
>
> we get problems:
>
> cmds-chunk.c: In function 'ask_user.clone.0':
> cmds-chunk.c:1343: warning: array subscript is above array bounds
>
> Fix it...
>
> Signed-off-by: Eric Sandeen <sandeen@redhat.com>
> ---
Thanks to fix this problem.
Reviewed-by: Miao Xie <miaox@cn.fujitsu.com>
>
>
> diff --git a/cmds-chunk.c b/cmds-chunk.c
> index 03314de..7c3257c 100644
> --- a/cmds-chunk.c
> +++ b/cmds-chunk.c
> @@ -1340,7 +1340,7 @@ again:
> }
> i++;
> }
> - answer[5] = '\0';
> + answer[4] = '\0';
> __fpurge(stdin);
>
> if (strlen(answer) == 0) {
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
next prev parent reply other threads:[~2013-08-06 3:16 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-08-06 2:52 [PATCH] btrfs-progs: don't overrun "answer" array in cmds-chunk.c Eric Sandeen
2013-08-06 3:17 ` Miao Xie [this message]
2013-08-06 3:57 ` Zach Brown
2013-08-06 4:03 ` Eric Sandeen
2013-08-06 5:57 ` Miao Xie
2013-08-06 18:49 ` Zach Brown
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=52006AB2.1080605@cn.fujitsu.com \
--to=miaox@cn.fujitsu.com \
--cc=linux-btrfs@vger.kernel.org \
--cc=sandeen@redhat.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.