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>
This commit is contained in:
@@ -438,9 +438,9 @@ static void deinterlace_device_run(void *priv)
|
||||
static int vidioc_querycap(struct file *file, void *priv,
|
||||
struct v4l2_capability *cap)
|
||||
{
|
||||
strlcpy(cap->driver, MEM2MEM_NAME, sizeof(cap->driver));
|
||||
strlcpy(cap->card, MEM2MEM_NAME, sizeof(cap->card));
|
||||
strlcpy(cap->bus_info, MEM2MEM_NAME, sizeof(cap->card));
|
||||
strscpy(cap->driver, MEM2MEM_NAME, sizeof(cap->driver));
|
||||
strscpy(cap->card, MEM2MEM_NAME, sizeof(cap->card));
|
||||
strscpy(cap->bus_info, MEM2MEM_NAME, sizeof(cap->card));
|
||||
/*
|
||||
* This is only a mem-to-mem video device. The capture and output
|
||||
* device capability flags are left only for backward compatibility
|
||||
@@ -474,7 +474,7 @@ static int enum_fmt(struct v4l2_fmtdesc *f, u32 type)
|
||||
if (i < NUM_FORMATS) {
|
||||
/* Format found */
|
||||
fmt = &formats[i];
|
||||
strlcpy(f->description, fmt->name, sizeof(f->description));
|
||||
strscpy(f->description, fmt->name, sizeof(f->description));
|
||||
f->pixelformat = fmt->fourcc;
|
||||
return 0;
|
||||
}
|
||||
|
Reference in New Issue
Block a user