summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLen Baker <len.baker@gmx.com>2021-07-17 18:05:12 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2021-07-27 15:10:41 +0200
commitfa8db3989362866ea1beb1314fc4e86f373a6425 (patch)
tree19997dc73759ecef1510659a636a0f9af88b7159
parent56315e55119c0ea57e142b6efb7c31208628ad86 (diff)
staging/most: Remove all strcpy() uses in favor of strscpy()
strcpy() performs no bounds checking on the destination buffer. This could result in linear overflows beyond the end of the buffer, leading to all kinds of misbehaviors. The safe replacement is strscpy(). Signed-off-by: Len Baker <len.baker@gmx.com> Link: https://lore.kernel.org/r/20210717160512.16176-1-len.baker@gmx.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/staging/most/video/video.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/staging/most/video/video.c b/drivers/staging/most/video/video.c
index 90933d78c332..b7858e47145f 100644
--- a/drivers/staging/most/video/video.c
+++ b/drivers/staging/most/video/video.c
@@ -258,7 +258,7 @@ static int vidioc_enum_fmt_vid_cap(struct file *file, void *priv,
if (f->index)
return -EINVAL;
- strcpy(f->description, "MPEG");
+ strscpy(f->description, "MPEG", sizeof(f->description));
f->type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
f->flags = V4L2_FMT_FLAG_COMPRESSED;
f->pixelformat = V4L2_PIX_FMT_MPEG;
@@ -306,7 +306,7 @@ static int vidioc_enum_input(struct file *file, void *priv,
if (input->index >= V4L2_CMP_MAX_INPUT)
return -EINVAL;
- strcpy(input->name, "MOST Video");
+ strscpy(input->name, "MOST Video", sizeof(input->name));
input->type |= V4L2_INPUT_TYPE_CAMERA;
input->audioset = 0;