aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/video/fbdev/uvesafb.c
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2020-03-11 10:32:30 +0100
committerBartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>2020-03-20 14:29:06 +0100
commit06b522d6de9d7b429f368210c93d5414ead3586b (patch)
treee162424fbc35658a9f35d6db9838873ef4b339bc /drivers/video/fbdev/uvesafb.c
parentvideo: omap2: Use scnprintf() for avoiding potential buffer overflow (diff)
downloadlinux-dev-06b522d6de9d7b429f368210c93d5414ead3586b.tar.xz
linux-dev-06b522d6de9d7b429f368210c93d5414ead3586b.zip
video: uvesafb: 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> Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com> Link: https://patchwork.freedesktop.org/patch/msgid/20200311093230.24900-4-tiwai@suse.de
Diffstat (limited to 'drivers/video/fbdev/uvesafb.c')
-rw-r--r--drivers/video/fbdev/uvesafb.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/video/fbdev/uvesafb.c b/drivers/video/fbdev/uvesafb.c
index 53d08d1b56f5..1b385cf76110 100644
--- a/drivers/video/fbdev/uvesafb.c
+++ b/drivers/video/fbdev/uvesafb.c
@@ -1560,7 +1560,7 @@ static ssize_t uvesafb_show_vbe_modes(struct device *dev,
int ret = 0, i;
for (i = 0; i < par->vbe_modes_cnt && ret < PAGE_SIZE; i++) {
- ret += snprintf(buf + ret, PAGE_SIZE - ret,
+ ret += scnprintf(buf + ret, PAGE_SIZE - ret,
"%dx%d-%d, 0x%.4x\n",
par->vbe_modes[i].x_res, par->vbe_modes[i].y_res,
par->vbe_modes[i].depth, par->vbe_modes[i].mode_id);