Skip to content

Commit edd6608

Browse files
tiwairafaeljw
authored andcommitted
ACPI: PCI: 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 <[email protected]> Signed-off-by: Rafael J. Wysocki <[email protected]>
1 parent 2c523b3 commit edd6608

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/acpi/pci_root.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ static void decode_osc_bits(struct acpi_pci_root *root, char *msg, u32 word,
153153
buf[0] = '\0';
154154
for (i = 0, entry = table; i < size; i++, entry++)
155155
if (word & entry->bit)
156-
len += snprintf(buf + len, sizeof(buf) - len, "%s%s",
156+
len += scnprintf(buf + len, sizeof(buf) - len, "%s%s",
157157
len ? " " : "", entry->desc);
158158

159159
dev_info(&root->device->dev, "_OSC: %s [%s]\n", msg, buf);

0 commit comments

Comments
 (0)