From: Geert Uytterhoeven <geert@linux-m68k.org>
To: Rickard Strandqvist <rickard_strandqvist@spectrumdigital.se>
Cc: Michal Januszewski <spock@gentoo.org>,
Jean-Christophe Plagniol-Villard <plagnioj@jcrosoft.com>,
Andi Kleen <ak@linux.intel.com>,
Andrew Morton <akpm@linux-foundation.org>,
Dan Carpenter <dan.carpenter@oracle.com>,
Grant Likely <grant.likely@linaro.org>,
Tomi Valkeinen <tomi.valkeinen@ti.com>,
Linux Fbdev development list <linux-fbdev@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 3/5] video: fbdev: uvesafb.c: Cleaning up missing null-terminate by switching from strncp
Date: Mon, 20 Oct 2014 07:10:37 +0000 [thread overview]
Message-ID: <CAMuHMdV-2-t_NaH04pS4nRskDXswn7j2nuxSxp0gOAHfvTJ7FQ@mail.gmail.com> (raw)
In-Reply-To: <1413670496-6387-1-git-send-email-rickard_strandqvist@spectrumdigital.se>
On Sun, Oct 19, 2014 at 12:14 AM, Rickard Strandqvist
<rickard_strandqvist@spectrumdigital.se> wrote:
> Ensures that the string is null-terminate in connection with the
> use of strncpy, by switching from strncpy to strzcpy.
>
> Signed-off-by: Rickard Strandqvist <rickard_strandqvist@spectrumdigital.se>
> ---
> drivers/video/fbdev/uvesafb.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/video/fbdev/uvesafb.c b/drivers/video/fbdev/uvesafb.c
> index 509d452..3383b34 100644
> --- a/drivers/video/fbdev/uvesafb.c
> +++ b/drivers/video/fbdev/uvesafb.c
> @@ -1892,7 +1892,7 @@ static ssize_t show_v86d(struct device_driver *dev, char *buf)
> static ssize_t store_v86d(struct device_driver *dev, const char *buf,
> size_t count)
> {
> - strncpy(v86d_path, buf, PATH_MAX);
> + strzcpy(v86d_path, buf, sizeof(v86d_path));
I think strlcpy() should be good enough here?
Or am I missing a reason why the rest of the buffer should be zero-filled?
Nevertheless, I think this (or an alternative) change should be applied to
stable, as call_usermodehelper() might crash by writing to sysfs.
> return count;
> }
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
prev parent reply other threads:[~2014-10-20 7:10 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-10-18 22:14 [PATCH 3/5] video: fbdev: uvesafb.c: Cleaning up missing null-terminate by switching from strncpy t Rickard Strandqvist
2014-10-20 7:10 ` Geert Uytterhoeven [this message]
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=CAMuHMdV-2-t_NaH04pS4nRskDXswn7j2nuxSxp0gOAHfvTJ7FQ@mail.gmail.com \
--to=geert@linux-m68k.org \
--cc=ak@linux.intel.com \
--cc=akpm@linux-foundation.org \
--cc=dan.carpenter@oracle.com \
--cc=grant.likely@linaro.org \
--cc=linux-fbdev@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=plagnioj@jcrosoft.com \
--cc=rickard_strandqvist@spectrumdigital.se \
--cc=spock@gentoo.org \
--cc=tomi.valkeinen@ti.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).