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

mfd: aat2870: Use scnprintf() for avoiding potential buffer overflow

There is still one call of sprintf() without checking the proper
buffer overflow in aat2870_dump_reg(). Replace it with scnprintf()
call for covering that.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Lee Jones <lee.jones@linaro.org>

authored by

Takashi Iwai and committed by
Lee Jones
c2b5fdfb e3fadb35

+1 -1
+1 -1
drivers/mfd/aat2870-core.c
··· 221 221 222 222 count += sprintf(buf, "aat2870 registers\n"); 223 223 for (addr = 0; addr < AAT2870_REG_NUM; addr++) { 224 - count += sprintf(buf + count, "0x%02x: ", addr); 224 + count += snprintf(buf + count, PAGE_SIZE - count, "0x%02x: ", addr); 225 225 if (count >= PAGE_SIZE - 1) 226 226 break; 227 227