diff options
author | Takashi Iwai <tiwai@suse.de> | 2020-03-11 10:19:44 +0100 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2020-03-12 09:23:59 +0100 |
commit | 234ff54287c1ce1d92eb807eb285adceb1c86b8c (patch) | |
tree | d23aeb75b09d4004e0716308af1254c8f93efc01 /drivers/staging/most | |
parent | 1693a2fa4b1f7662a67617c8fb42c82070a712a4 (diff) |
staging: most: core: Use scnprintf() for avoiding potential buffer overflow
Since snprintf() returns the would-be-output size instead of the
actual output size, the succeeding calls may go beyond the given
buffer limit. Fix it by replacing with scnprintf().
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Link: https://lore.kernel.org/r/20200311091944.23185-1-tiwai@suse.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/most')
-rw-r--r-- | drivers/staging/most/core.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/staging/most/core.c b/drivers/staging/most/core.c index 0c4ae6920d77..f6b38d9d57e6 100644 --- a/drivers/staging/most/core.c +++ b/drivers/staging/most/core.c @@ -472,7 +472,7 @@ static int print_links(struct device *dev, void *data) list_for_each_entry(c, &iface->p->channel_list, list) { if (c->pipe0.comp) { - offs += snprintf(buf + offs, + offs += scnprintf(buf + offs, PAGE_SIZE - offs, "%s:%s:%s\n", c->pipe0.comp->name, @@ -480,7 +480,7 @@ static int print_links(struct device *dev, void *data) dev_name(&c->dev)); } if (c->pipe1.comp) { - offs += snprintf(buf + offs, + offs += scnprintf(buf + offs, PAGE_SIZE - offs, "%s:%s:%s\n", c->pipe1.comp->name, @@ -519,7 +519,7 @@ static ssize_t components_show(struct device_driver *drv, char *buf) int offs = 0; list_for_each_entry(comp, &comp_list, list) { - offs += snprintf(buf + offs, PAGE_SIZE - offs, "%s\n", + offs += scnprintf(buf + offs, PAGE_SIZE - offs, "%s\n", comp->name); } return offs; |