strscpy() vs strlcpy() and WARN_ONCE()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



commit c0decac19da3906d9b66291e57b7759489e1170f
Author: Mauro Carvalho Chehab <mchehab+samsung@xxxxxxxxxx>
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@xxxxxxxxxx>
    Reviewed-by: Kees Cook <keescook@xxxxxxxxxxxx>
    Acked-by: Hans Verkuil <hans.verkuil@xxxxxxxxx>
    Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@xxxxxxxxxx>

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



[Index of Archives]     [Linux Input]     [Video for Linux]     [Gstreamer Embedded]     [Mplayer Users]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]

  Powered by Linux