* [PATCH 3/5] video: fbdev: uvesafb.c: Cleaning up missing null-terminate by switching from strncpy to strzcpy
@ 2014-10-18 22:14 Rickard Strandqvist
2014-10-20 7:10 ` Geert Uytterhoeven
0 siblings, 1 reply; 2+ messages in thread
From: Rickard Strandqvist @ 2014-10-18 22:14 UTC (permalink / raw)
To: Michal Januszewski, Jean-Christophe Plagniol-Villard
Cc: Rickard Strandqvist, Andi Kleen, Andrew Morton, Dan Carpenter,
Grant Likely, Tomi Valkeinen, linux-fbdev, linux-kernel
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));
return count;
}
--
1.7.10.4
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH 3/5] video: fbdev: uvesafb.c: Cleaning up missing null-terminate by switching from strncpy to strzcpy
2014-10-18 22:14 [PATCH 3/5] video: fbdev: uvesafb.c: Cleaning up missing null-terminate by switching from strncpy to strzcpy Rickard Strandqvist
@ 2014-10-20 7:10 ` Geert Uytterhoeven
0 siblings, 0 replies; 2+ messages in thread
From: Geert Uytterhoeven @ 2014-10-20 7:10 UTC (permalink / raw)
To: Rickard Strandqvist
Cc: Michal Januszewski, Jean-Christophe Plagniol-Villard, Andi Kleen,
Andrew Morton, Dan Carpenter, Grant Likely, Tomi Valkeinen,
Linux Fbdev development list, linux-kernel
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
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2014-10-20 7:10 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-10-18 22:14 [PATCH 3/5] video: fbdev: uvesafb.c: Cleaning up missing null-terminate by switching from strncpy to strzcpy Rickard Strandqvist
2014-10-20 7:10 ` Geert Uytterhoeven
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).