From: Sumeet Pawnikar <sumeet4linux@gmail.com>
To: rafael@kernel.org, robert.moore@intel.com, lenb@kernel.org,
linux-acpi@vger.kernel.org, acpica-devel@lists.linux.dev
Cc: linux-kernel@vger.kernel.org, sumeet4linux@gmail.com
Subject: [PATCH] tools/power/acpi: Replace unsafe strcpy with snprintf in apdump.c
Date: Sun, 1 Feb 2026 23:51:41 +0530 [thread overview]
Message-ID: <20260201182141.5039-1-sumeet4linux@gmail.com> (raw)
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
reply other threads:[~2026-02-01 18:21 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260201182141.5039-1-sumeet4linux@gmail.com \
--to=sumeet4linux@gmail.com \
--cc=acpica-devel@lists.linux.dev \
--cc=lenb@kernel.org \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=rafael@kernel.org \
--cc=robert.moore@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox