From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Alex Williamson <alex.williamson@hp.com>,
Alex Chiang <achiang@hp.com>,
linux-kernel@vger.kernel.org, stable@vger.kernel.org
Subject: Re: [PATCH] sysfs: sysfs_pathname/sysfs_add_one: Use strlcat() instead of strcat()
Date: Sun, 30 Sep 2012 07:49:30 -0700 [thread overview]
Message-ID: <20120930144930.GA27329@kroah.com> (raw)
In-Reply-To: <1348950199-30460-1-git-send-email-geert@linux-m68k.org>
On Sat, Sep 29, 2012 at 10:23:19PM +0200, Geert Uytterhoeven wrote:
> The warning check for duplicate sysfs entries can cause a buffer overflow
> when printing the warning, as strcat() doesn't check buffer sizes.
> Use strlcat() instead.
As the comment said, we knew about this, but I have never seen it, do
you know of a way to trigger it?
> Since strlcat() doesn't return a pointer to the passed buffer, unlike
> strcat(), I had to convert the nested concatenation in sysfs_add_one() to
> an admittedly more obscure comma operator construct, to avoid emitting code
> for the concatenation if CONFIG_BUG is disabled.
That's a fun construct, nice work.
> Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
> Cc: stable@vger.kernel.org
Given that I don't know of any way to actually hit this problem, is it
really needed for older kernel releases?
thanks,
greg k-h
next prev parent reply other threads:[~2012-09-30 14:49 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-09-29 20:23 [PATCH] sysfs: sysfs_pathname/sysfs_add_one: Use strlcat() instead of strcat() Geert Uytterhoeven
2012-09-30 14:49 ` Greg Kroah-Hartman [this message]
2012-09-30 18:59 ` Geert Uytterhoeven
2012-10-01 23:51 ` Greg Kroah-Hartman
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=20120930144930.GA27329@kroah.com \
--to=gregkh@linuxfoundation.org \
--cc=achiang@hp.com \
--cc=alex.williamson@hp.com \
--cc=geert@linux-m68k.org \
--cc=linux-kernel@vger.kernel.org \
--cc=stable@vger.kernel.org \
/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