From: Joe Perches <joe@perches.com>
To: Kees Cook <keescook@chromium.org>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
linux-kernel@vger.kernel.org,
Bradley Grove <linuxdrivers@attotech.com>,
"James E.J. Bottomley" <JBottomley@parallels.com>,
linux-scsi@vger.kernel.org
Subject: Re: [RESEND][PATCH] scsi: esas2r: fix potential format string flaw
Date: Tue, 17 Dec 2013 21:42:50 -0800 [thread overview]
Message-ID: <1387345370.13593.10.camel@joe-AO722> (raw)
In-Reply-To: <20131217182733.GA16202@www.outflux.net>
On Tue, 2013-12-17 at 10:27 -0800, Kees Cook wrote:
> This makes sure format strings cannot leak into the printk call via the
> constructed buffer.
[]
> diff --git a/drivers/scsi/esas2r/esas2r_log.c b/drivers/scsi/esas2r/esas2r_log.c
[]
> @@ -171,7 +171,7 @@ static int esas2r_log_master(const long level,
> if (strlen(event_buffer) < buflen)
> strcat(buffer, "\n");
>
> - printk(event_buffer);
> + printk("%s", event_buffer);
It's probably better to remove the
if (strlen(event_buffer) < buflen)
strcat(buffer, "\n");
and use
printk("%s\n", event_buffer);
so that the output is always newline terminated.
next prev parent reply other threads:[~2013-12-18 5:42 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-12-17 18:27 [RESEND][PATCH] scsi: esas2r: fix potential format string flaw Kees Cook
2013-12-17 20:00 ` Greg Kroah-Hartman
2013-12-17 21:17 ` Kees Cook
2013-12-17 21:54 ` Greg Kroah-Hartman
2013-12-17 21:45 ` Bradley Grove
2013-12-18 5:42 ` Joe Perches [this message]
2013-12-18 18:01 ` Kees Cook
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=1387345370.13593.10.camel@joe-AO722 \
--to=joe@perches.com \
--cc=JBottomley@parallels.com \
--cc=gregkh@linuxfoundation.org \
--cc=keescook@chromium.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=linuxdrivers@attotech.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).