Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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

authored by

Takashi Iwai and committed by
Bartlomiej Zolnierkiewicz
06b522d6 42f21e54

+1 -1
+1 -1
drivers/video/fbdev/uvesafb.c
··· 1560 1560 int ret = 0, i; 1561 1561 1562 1562 for (i = 0; i < par->vbe_modes_cnt && ret < PAGE_SIZE; i++) { 1563 - ret += snprintf(buf + ret, PAGE_SIZE - ret, 1563 + ret += scnprintf(buf + ret, PAGE_SIZE - ret, 1564 1564 "%dx%d-%d, 0x%.4x\n", 1565 1565 par->vbe_modes[i].x_res, par->vbe_modes[i].y_res, 1566 1566 par->vbe_modes[i].depth, par->vbe_modes[i].mode_id);