linux-media.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* strscpy() vs strlcpy() and WARN_ONCE()
@ 2018-12-13 12:37 Hans Petter Selasky
  2019-01-25 13:01 ` [PATCH] strscpy() returns a negative value on failure unlike strlcpy() Hans Petter Selasky
  0 siblings, 1 reply; 2+ messages in thread
From: Hans Petter Selasky @ 2018-12-13 12:37 UTC (permalink / raw)
  To: linux-media, Mauro Carvalho Chehab

> commit c0decac19da3906d9b66291e57b7759489e1170f
> Author: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
> Date:   Mon Sep 10 08:19:14 2018 -0400
> 
>     media: use strscpy() instead of strlcpy()
>     
>     The implementation of strscpy() is more robust and safer.
>     
>     That's now the recommended way to copy NUL terminated strings.
>     
>     Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
>     Reviewed-by: Kees Cook <keescook@chromium.org>
>     Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
>     Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>

Hi Mauro,

The following piece of the commit above I believe is wrong:

>         if (descr)
> -               WARN_ON(strlcpy(fmt->description, descr, sz) >= sz);
> +               WARN_ON(strscpy(fmt->description, descr, sz) >= sz);
>         fmt->flags = flags;

It should be:
		WARN_ON(strscpy(fmt->description, descr, sz) < 0);

I don't have time to make a full patch for this so please handle this 
issue for me. Thank you!

--HPS

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-01-25 13:11 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-12-13 12:37 strscpy() vs strlcpy() and WARN_ONCE() Hans Petter Selasky
2019-01-25 13:01 ` [PATCH] strscpy() returns a negative value on failure unlike strlcpy() Hans Petter Selasky

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).