* [PATCH] tools/power/acpi: Replace unsafe strcpy with snprintf in apdump.c
@ 2026-02-01 18:21 Sumeet Pawnikar
0 siblings, 0 replies; only message in thread
From: Sumeet Pawnikar @ 2026-02-01 18:21 UTC (permalink / raw)
To: rafael, robert.moore, lenb, linux-acpi, acpica-devel
Cc: linux-kernel, sumeet4linux
Replace unsafe strcpy() calls with snprintf() in apdump.c to prevent
potential buffer overflow vulnerabilities when handling table signatures.
The snprintf() function performs automatic bounds checking to ensure
the destination buffer is not overflowed.
No functional change.
Signed-off-by: Sumeet Pawnikar <sumeet4linux@gmail.com>
---
tools/power/acpi/tools/acpidump/apdump.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/tools/power/acpi/tools/acpidump/apdump.c b/tools/power/acpi/tools/acpidump/apdump.c
index 7a6223aa703c..b566f9b832f1 100644
--- a/tools/power/acpi/tools/acpidump/apdump.c
+++ b/tools/power/acpi/tools/acpidump/apdump.c
@@ -308,15 +308,17 @@ int ap_dump_table_by_name(char *signature)
/* Table signatures are expected to be uppercase */
- strcpy(local_signature, signature);
+ snprintf(local_signature, sizeof(local_signature), "%s", signature);
acpi_ut_strupr(local_signature);
/* To be friendly, handle tables whose signatures do not match the name */
if (ACPI_COMPARE_NAMESEG(local_signature, "FADT")) {
- strcpy(local_signature, ACPI_SIG_FADT);
+ snprintf(local_signature, sizeof(local_signature), "%s",
+ ACPI_SIG_FADT);
} else if (ACPI_COMPARE_NAMESEG(local_signature, "MADT")) {
- strcpy(local_signature, ACPI_SIG_MADT);
+ snprintf(local_signature, sizeof(local_signature), "%s",
+ ACPI_SIG_MADT);
}
/* Dump all instances of this signature (to handle multiple SSDTs) */
--
2.43.0
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2026-02-01 18:21 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-02-01 18:21 [PATCH] tools/power/acpi: Replace unsafe strcpy with snprintf in apdump.c Sumeet Pawnikar
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox