Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Len Baker and committed by
Greg Kroah-Hartman
fa8db398 56315e55

+2 -2
+2 -2
drivers/staging/most/video/video.c
··· 258 258 if (f->index) 259 259 return -EINVAL; 260 260 261 - strcpy(f->description, "MPEG"); 261 + strscpy(f->description, "MPEG", sizeof(f->description)); 262 262 f->type = V4L2_BUF_TYPE_VIDEO_CAPTURE; 263 263 f->flags = V4L2_FMT_FLAG_COMPRESSED; 264 264 f->pixelformat = V4L2_PIX_FMT_MPEG; ··· 306 306 if (input->index >= V4L2_CMP_MAX_INPUT) 307 307 return -EINVAL; 308 308 309 - strcpy(input->name, "MOST Video"); 309 + strscpy(input->name, "MOST Video", sizeof(input->name)); 310 310 input->type |= V4L2_INPUT_TYPE_CAMERA; 311 311 input->audioset = 0; 312 312