From: Eric Sandeen <sandeen@redhat.com>
To: linux-btrfs <linux-btrfs@vger.kernel.org>
Cc: Miao Xie <miaox@cn.fujitsu.com>
Subject: [PATCH] btrfs-progs: don't overrun "answer" array in cmds-chunk.c
Date: Mon, 05 Aug 2013 21:52:57 -0500 [thread overview]
Message-ID: <52006509.1060207@redhat.com> (raw)
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>
---
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) {
next reply other threads:[~2013-08-06 2:53 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-08-06 2:52 Eric Sandeen [this message]
2013-08-06 3:17 ` [PATCH] btrfs-progs: don't overrun "answer" array in cmds-chunk.c Miao Xie
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=52006509.1060207@redhat.com \
--to=sandeen@redhat.com \
--cc=linux-btrfs@vger.kernel.org \
--cc=miaox@cn.fujitsu.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.