Commit e57b36c0 authored by Rasmus Villemoes's avatar Rasmus Villemoes Committed by Mauro Carvalho Chehab

[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: default avatarRasmus Villemoes <linux@rasmusvillemoes.dk>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@osg.samsung.com>
parent 9c574ad4
...@@ -116,8 +116,9 @@ videocodec_attach (struct videocodec_master *master) ...@@ -116,8 +116,9 @@ videocodec_attach (struct videocodec_master *master)
goto out_module_put; goto out_module_put;
} }
snprintf(codec->name, sizeof(codec->name), res = strlen(codec->name);
"%s[%d]", codec->name, h->attached); snprintf(codec->name + res, sizeof(codec->name) - res,
"[%d]", h->attached);
codec->master_data = master; codec->master_data = master;
res = codec->setup(codec); res = codec->setup(codec);
if (res == 0) { if (res == 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