Skip to content

Commit c2b5fdf

Browse files
tiwaiLee Jones
authored andcommitted
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 <[email protected]> Signed-off-by: Lee Jones <[email protected]>
1 parent e3fadb3 commit c2b5fdf

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/mfd/aat2870-core.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ static ssize_t aat2870_dump_reg(struct aat2870_data *aat2870, char *buf)
221221

222222
count += sprintf(buf, "aat2870 registers\n");
223223
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);
225225
if (count >= PAGE_SIZE - 1)
226226
break;
227227

0 commit comments

Comments
 (0)