From: Hans Petter Selasky <hps@selasky.org>
To: linux-media@vger.kernel.org,
Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
Subject: strscpy() vs strlcpy() and WARN_ONCE()
Date: Thu, 13 Dec 2018 13:37:14 +0100 [thread overview]
Message-ID: <506c194b-1dcf-b616-4b33-5fed3394a3a0@selasky.org> (raw)
> 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
next reply other threads:[~2018-12-13 12:47 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-12-13 12:37 Hans Petter Selasky [this message]
2019-01-25 13:01 ` [PATCH] strscpy() returns a negative value on failure unlike strlcpy() Hans Petter Selasky
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=506c194b-1dcf-b616-4b33-5fed3394a3a0@selasky.org \
--to=hps@selasky.org \
--cc=linux-media@vger.kernel.org \
--cc=mchehab+samsung@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;
as well as URLs for NNTP newsgroup(s).