From: Miao Xie <miaox@cn.fujitsu.com>
To: Zach Brown <zab@redhat.com>
Cc: Eric Sandeen <sandeen@redhat.com>,
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 13:57:46 +0800 [thread overview]
Message-ID: <5200905A.4080607@cn.fujitsu.com> (raw)
In-Reply-To: <20130806035757.GL12314@lenny.home.zabbo.net>
On Mon, 5 Aug 2013 20:57:57 -0700, Zach Brown wrote:
> On Mon, Aug 05, 2013 at 09:52:57PM -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';
>
> *high fives*
>
>> - answer[5] = '\0';
>> + answer[4] = '\0';
>
> I went to see which way of avoiding another magical raw constant would
> be best and did a bit of a double take.
>
> If you're in here, want to reimplement this thing in a few lines of
> scanf(%s) and strcasecmp()? I can give it a go if you don't want to.
>
I think it is better that moving it to utils.c because the other commands
may use it in the future.
Thanks
Miao
next prev parent reply other threads:[~2013-08-06 5:56 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
2013-08-06 3:57 ` Zach Brown
2013-08-06 4:03 ` Eric Sandeen
2013-08-06 5:57 ` Miao Xie [this message]
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=5200905A.4080607@cn.fujitsu.com \
--to=miaox@cn.fujitsu.com \
--cc=linux-btrfs@vger.kernel.org \
--cc=sandeen@redhat.com \
--cc=zab@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).