git: a9a267c1f7a5 - main - acpi_thermal: Fix a potential stack buffer overflow.
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Mon, 03 Oct 2022 18:22:50 UTC
The branch main has been updated by jhb:
URL: https://cgit.FreeBSD.org/src/commit/?id=a9a267c1f7a5a6284398bd7ae6ac0c2a0643ece2
commit a9a267c1f7a5a6284398bd7ae6ac0c2a0643ece2
Author: Johannes Totz <jo@bruelltuete.com>
AuthorDate: 2022-10-03 18:09:57 +0000
Commit: John Baldwin <jhb@FreeBSD.org>
CommitDate: 2022-10-03 18:16:27 +0000
acpi_thermal: Fix a potential stack buffer overflow.
While here, fix a typo as well.
Reviewed by: jhb
Differential Revision: https://reviews.freebsd.org/D36495
---
sys/dev/acpica/acpi_thermal.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/sys/dev/acpica/acpi_thermal.c b/sys/dev/acpica/acpi_thermal.c
index 7a5cb8ebb64e..bd9ecf455e26 100644
--- a/sys/dev/acpica/acpi_thermal.c
+++ b/sys/dev/acpica/acpi_thermal.c
@@ -176,7 +176,7 @@ static int acpi_tz_min_runtime;
static int acpi_tz_polling_rate = TZ_POLLRATE;
static int acpi_tz_override;
-/* Timezone polling thread */
+/* Thermal zone polling thread */
static struct proc *acpi_tz_proc;
ACPI_LOCK_DECL(thermal, "ACPI thermal zone");
@@ -201,7 +201,7 @@ acpi_tz_attach(device_t dev)
struct acpi_tz_softc *sc;
struct acpi_softc *acpi_sc;
int error;
- char oidname[8];
+ char oidname[16];
ACPI_FUNCTION_TRACE((char *)(uintptr_t)__func__);
@@ -257,7 +257,7 @@ acpi_tz_attach(device_t dev)
"allow override of thermal settings");
}
sysctl_ctx_init(&sc->tz_sysctl_ctx);
- sprintf(oidname, "tz%d", device_get_unit(dev));
+ snprintf(oidname, sizeof(oidname), "tz%d", device_get_unit(dev));
sc->tz_sysctl_tree = SYSCTL_ADD_NODE_WITH_LABEL(&sc->tz_sysctl_ctx,
SYSCTL_CHILDREN(acpi_tz_sysctl_tree), OID_AUTO, oidname,
CTLFLAG_RD | CTLFLAG_MPSAFE, 0, "", "thermal_zone");