[media] stk1160: warrant a NUL terminated string
authorMauro Carvalho Chehab <m.chehab@samsung.com>
Mon, 7 Apr 2014 13:39:23 +0000 (10:39 -0300)
committerMauro Carvalho Chehab <m.chehab@samsung.com>
Tue, 8 Apr 2014 14:00:52 +0000 (11:00 -0300)
strncpy() doesn't warrant a NUL terminated string. Use
strlcpy() instead.

Fixes Coverity bug CID#1195195.

Acked-by: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>
Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
drivers/media/usb/stk1160/stk1160-ac97.c

index c46c8be896029534f2b08228eee825247398995d..2dd308f9541f469b719adf7d53f01901f4525b3e 100644 (file)
@@ -108,7 +108,7 @@ int stk1160_ac97_register(struct stk1160 *dev)
                 "stk1160-mixer");
        snprintf(card->longname, sizeof(card->longname),
                 "stk1160 ac97 codec mixer control");
-       strncpy(card->driver, dev->dev->driver->name, sizeof(card->driver));
+       strlcpy(card->driver, dev->dev->driver->name, sizeof(card->driver));
 
        rc = snd_ac97_bus(card, 0, &stk1160_ac97_ops, NULL, &ac97_bus);
        if (rc)