diff options
author | Rasmus Villemoes <linux@rasmusvillemoes.dk> | 2016-03-08 20:40:51 (GMT) |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@osg.samsung.com> | 2016-05-07 13:27:07 (GMT) |
commit | e57b36c0c46d7288d6d5bd602003b8fcd17efe3f (patch) | |
tree | 01f529695791ef148d2d18c571b0d29326d993a3 /drivers/media | |
parent | 9c574ad4d360353ec8dd6bc85e78d8b2d0f8e775 (diff) | |
download | linux-e57b36c0c46d7288d6d5bd602003b8fcd17efe3f.tar.xz |
[media] drivers/media/pci/zoran: avoid fragile snprintf use
Appending to a string by doing snprintf(buf, bufsize, "%s...", buf,
...) is not guaranteed to work.
Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Diffstat (limited to 'drivers/media')
-rw-r--r-- | drivers/media/pci/zoran/videocodec.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/media/pci/zoran/videocodec.c b/drivers/media/pci/zoran/videocodec.c index c010716..13a3c07 100644 --- a/drivers/media/pci/zoran/videocodec.c +++ b/drivers/media/pci/zoran/videocodec.c @@ -116,8 +116,9 @@ videocodec_attach (struct videocodec_master *master) goto out_module_put; } - snprintf(codec->name, sizeof(codec->name), - "%s[%d]", codec->name, h->attached); + res = strlen(codec->name); + snprintf(codec->name + res, sizeof(codec->name) - res, + "[%d]", h->attached); codec->master_data = master; res = codec->setup(codec); if (res == 0) { |