[media] gspca: s/strncpy/strlcpy/
authorHans de Goede <hdegoede@redhat.com>
Sun, 5 Jun 2011 17:58:46 +0000 (14:58 -0300)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Wed, 27 Jul 2011 20:53:42 +0000 (17:53 -0300)
Just like in userspace strncpy does not guarantee 0 termination. Use strlcpy
instead which does guarantee 0 termination.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
drivers/media/video/gspca/gspca.c
drivers/media/video/gspca/t613.c

index d94c108dd8dcf224dd5746b9fcf4d34cc4a8b60a..5da4879f47f2c3e01342479add75a04332e48fa8 100644 (file)
@@ -1281,10 +1281,10 @@ static int vidioc_querycap(struct file *file, void  *priv,
                ret = -ENODEV;
                goto out;
        }
-       strncpy((char *) cap->driver, gspca_dev->sd_desc->name,
+       strlcpy((char *) cap->driver, gspca_dev->sd_desc->name,
                        sizeof cap->driver);
        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);
        } else {
                snprintf((char *) cap->card, sizeof cap->card,
@@ -1462,7 +1462,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;
-       strncpy(input->name, gspca_dev->sd_desc->name,
+       strlcpy(input->name, gspca_dev->sd_desc->name,
                sizeof input->name);
        return 0;
 }
index 7e762d55109915d52e0d7306e554f2210d2f6461..d1d733b9359b41e9f012a6d6b651d2f4b2597a3b 100644 (file)
@@ -1387,7 +1387,7 @@ static int sd_querymenu(struct gspca_dev *gspca_dev,
                return 0;
        case V4L2_CID_EFFECTS:
                if ((unsigned) menu->index < ARRAY_SIZE(effects_control)) {
-                       strncpy((char *) menu->name,
+                       strlcpy((char *) menu->name,
                                effects_control[menu->index],
                                sizeof menu->name);
                        return 0;