Commit e7d712cc authored by Hans de Goede's avatar Hans de Goede Committed by Mauro Carvalho Chehab

[media] gspca: s/strncpy/strlcpy/

Just like in userspace strncpy does not guarantee 0 termination. Use strlcpy
instead which does guarantee 0 termination.
Signed-off-by: default avatarHans de Goede <hdegoede@redhat.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent 2f2ea0f3
...@@ -1281,10 +1281,10 @@ static int vidioc_querycap(struct file *file, void *priv, ...@@ -1281,10 +1281,10 @@ static int vidioc_querycap(struct file *file, void *priv,
ret = -ENODEV; ret = -ENODEV;
goto out; goto out;
} }
strncpy((char *) cap->driver, gspca_dev->sd_desc->name, strlcpy((char *) cap->driver, gspca_dev->sd_desc->name,
sizeof cap->driver); sizeof cap->driver);
if (gspca_dev->dev->product != NULL) { if (gspca_dev->dev->product != NULL) {
strncpy((char *) cap->card, gspca_dev->dev->product, strlcpy((char *) cap->card, gspca_dev->dev->product,
sizeof cap->card); sizeof cap->card);
} else { } else {
snprintf((char *) cap->card, sizeof cap->card, snprintf((char *) cap->card, sizeof cap->card,
...@@ -1462,7 +1462,7 @@ static int vidioc_enum_input(struct file *file, void *priv, ...@@ -1462,7 +1462,7 @@ static int vidioc_enum_input(struct file *file, void *priv,
return -EINVAL; return -EINVAL;
input->type = V4L2_INPUT_TYPE_CAMERA; input->type = V4L2_INPUT_TYPE_CAMERA;
input->status = gspca_dev->cam.input_flags; input->status = gspca_dev->cam.input_flags;
strncpy(input->name, gspca_dev->sd_desc->name, strlcpy(input->name, gspca_dev->sd_desc->name,
sizeof input->name); sizeof input->name);
return 0; return 0;
} }
......
...@@ -1387,7 +1387,7 @@ static int sd_querymenu(struct gspca_dev *gspca_dev, ...@@ -1387,7 +1387,7 @@ static int sd_querymenu(struct gspca_dev *gspca_dev,
return 0; return 0;
case V4L2_CID_EFFECTS: case V4L2_CID_EFFECTS:
if ((unsigned) menu->index < ARRAY_SIZE(effects_control)) { if ((unsigned) menu->index < ARRAY_SIZE(effects_control)) {
strncpy((char *) menu->name, strlcpy((char *) menu->name,
effects_control[menu->index], effects_control[menu->index],
sizeof menu->name); sizeof menu->name);
return 0; return 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment