[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>
This commit is contained in:
parent
9c574ad4d3
commit
e57b36c0c4
@ -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) {
|
||||
|
Loading…
Reference in New Issue
Block a user