From: Corey Minyard <tcminyard@gmail.com>
To: Chen Gang <gang.chen@asianux.com>
Cc: Greg KH <gregkh@linuxfoundation.org>,
openipmi-developer@lists.sourceforge.net,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] drivers/char/ipmi: memcpy, need additional 2 bytes to avoid memory overflow
Date: Fri, 29 Mar 2013 08:51:06 -0500 [thread overview]
Message-ID: <51559C4A.7060905@acm.org> (raw)
In-Reply-To: <51554055.90500@asianux.com>
Yes, this is correct, I've pulled it into my tree.
-corey
On 03/29/2013 02:18 AM, Chen Gang wrote:
> when calling memcpy, read_data and write_data need additional 2 bytes.
>
> write_data:
> for checking: "if (size > IPMI_MAX_MSG_LENGTH)"
> for operating: "memcpy(bt->write_data + 3, data + 1, size - 1)"
>
> read_data:
> for checking: "if (msg_len < 3 || msg_len > IPMI_MAX_MSG_LENGTH)"
> for operating: "memcpy(data + 2, bt->read_data + 4, msg_len - 2)"
>
>
> Signed-off-by: Chen Gang <gang.chen@asianux.com>
> ---
> drivers/char/ipmi/ipmi_bt_sm.c | 4 ++--
> 1 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/char/ipmi/ipmi_bt_sm.c b/drivers/char/ipmi/ipmi_bt_sm.c
> index cdd4c09f..a22a7a5 100644
> --- a/drivers/char/ipmi/ipmi_bt_sm.c
> +++ b/drivers/char/ipmi/ipmi_bt_sm.c
> @@ -95,9 +95,9 @@ struct si_sm_data {
> enum bt_states state;
> unsigned char seq; /* BT sequence number */
> struct si_sm_io *io;
> - unsigned char write_data[IPMI_MAX_MSG_LENGTH];
> + unsigned char write_data[IPMI_MAX_MSG_LENGTH + 2]; /* +2 for memcpy */
> int write_count;
> - unsigned char read_data[IPMI_MAX_MSG_LENGTH];
> + unsigned char read_data[IPMI_MAX_MSG_LENGTH + 2]; /* +2 for memcpy */
> int read_count;
> int truncated;
> long timeout; /* microseconds countdown */
next prev parent reply other threads:[~2013-03-29 13:51 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-03-29 7:18 [PATCH] drivers/char/ipmi: memcpy, need additional 2 bytes to avoid memory overflow Chen Gang
2013-03-29 13:51 ` Corey Minyard [this message]
2013-03-30 2:55 ` Chen Gang
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=51559C4A.7060905@acm.org \
--to=tcminyard@gmail.com \
--cc=gang.chen@asianux.com \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=minyard@acm.org \
--cc=openipmi-developer@lists.sourceforge.net \
/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.