summaryrefslogtreecommitdiff
path: root/drivers/media/usb/gspca
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab+samsung@kernel.org>2018-09-10 15:19:14 +0300
committerMauro Carvalho Chehab <mchehab+samsung@kernel.org>2018-09-11 20:32:17 +0300
commitc0decac19da3906d9b66291e57b7759489e1170f (patch)
tree0eeb1f7d2c5464e0c87e0c788fd8fb581662c621 /drivers/media/usb/gspca
parentb730c40813a95ebc35757790a990794f55e2b61c (diff)
downloadlinux-c0decac19da3906d9b66291e57b7759489e1170f.tar.xz
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>
Diffstat (limited to 'drivers/media/usb/gspca')
-rw-r--r--drivers/media/usb/gspca/gspca.c10
-rw-r--r--drivers/media/usb/gspca/sn9c20x.c2
2 files changed, 6 insertions, 6 deletions
diff --git a/drivers/media/usb/gspca/gspca.c b/drivers/media/usb/gspca/gspca.c
index 57aa521e16b1..fce9d6f4b7c9 100644
--- a/drivers/media/usb/gspca/gspca.c
+++ b/drivers/media/usb/gspca/gspca.c
@@ -1193,11 +1193,11 @@ static int vidioc_querycap(struct file *file, void *priv,
{
struct gspca_dev *gspca_dev = video_drvdata(file);
- strlcpy((char *) cap->driver, gspca_dev->sd_desc->name,
- sizeof cap->driver);
+ strscpy((char *)cap->driver, gspca_dev->sd_desc->name,
+ sizeof(cap->driver));
if (gspca_dev->dev->product != NULL) {
- strlcpy((char *) cap->card, gspca_dev->dev->product,
- sizeof cap->card);
+ strscpy((char *)cap->card, gspca_dev->dev->product,
+ sizeof(cap->card));
} else {
snprintf((char *) cap->card, sizeof cap->card,
"USB Camera (%04x:%04x)",
@@ -1222,7 +1222,7 @@ static int vidioc_enum_input(struct file *file, void *priv,
return -EINVAL;
input->type = V4L2_INPUT_TYPE_CAMERA;
input->status = gspca_dev->cam.input_flags;
- strlcpy(input->name, gspca_dev->sd_desc->name,
+ strscpy(input->name, gspca_dev->sd_desc->name,
sizeof input->name);
return 0;
}
diff --git a/drivers/media/usb/gspca/sn9c20x.c b/drivers/media/usb/gspca/sn9c20x.c
index cfa2a04d9f3f..5984bb12bcff 100644
--- a/drivers/media/usb/gspca/sn9c20x.c
+++ b/drivers/media/usb/gspca/sn9c20x.c
@@ -1601,7 +1601,7 @@ static int sd_chip_info(struct gspca_dev *gspca_dev,
if (chip->match.addr > 1)
return -EINVAL;
if (chip->match.addr == 1)
- strlcpy(chip->name, "sensor", sizeof(chip->name));
+ strscpy(chip->name, "sensor", sizeof(chip->name));
return 0;
}
#endif