From nobody Mon Oct 03 18:22:50 2022 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Mh8MZ4Lzdz4dsgc; Mon, 3 Oct 2022 18:22:50 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Mh8MZ3jq1z406b; Mon, 3 Oct 2022 18:22:50 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1664821370; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=uvhEbSIRZYSLQXQUgQffQherxQvrh526RRhd2PJHO3I=; b=amxG+ffyejIMsqEGWZ++M3zFGh18Oc96ZIHGOTlxvlUzvGVgEXnr/YIYeh43sOQAdi6Ekn VpcVcnv1miVS0RY7bJivTHEM7P58mEfcAYpXccgG1p4K2SC1Yv3AF52VR3pbT2Itdhdew8 EJd7+skWfBKDud+4WI8mYWecNv17AVAoVb+55UZT+cxMS9z8zofXcfs41FDL7eZmARtGmF agyRw2B+mGmdL3C7qVzywpoHFaMKJZk/2hS0E7wG7TrCiyU8dUntcsxHDDZaHBZizctR+M fCalaRW1aTvNSG0laz1AEV9aL4Rlnx0KQ5aZ0Dff+6LxBC4wzSArCA8Ob3tY1g== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Mh8MZ2lfHzHlx; Mon, 3 Oct 2022 18:22:50 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 293IMo6K005749; Mon, 3 Oct 2022 18:22:50 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 293IMonv005748; Mon, 3 Oct 2022 18:22:50 GMT (envelope-from git) Date: Mon, 3 Oct 2022 18:22:50 GMT Message-Id: <202210031822.293IMonv005748@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: John Baldwin Subject: git: a9a267c1f7a5 - main - acpi_thermal: Fix a potential stack buffer overflow. List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: a9a267c1f7a5a6284398bd7ae6ac0c2a0643ece2 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1664821370; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=uvhEbSIRZYSLQXQUgQffQherxQvrh526RRhd2PJHO3I=; b=MsS3iBQBhzeoa8obOPu+vZEjN11cCw1kiKTrq79b/I9E8XdWirE30g3fqSAC85TTT8Iw3L htwXf63wuG6OjaEH5Rfs3222clJm25VYt/Q1g5imrwbJkdnO/ETpTGRps2NYDK0+FbGD7A J0vMbrHJIgL4Xk5W8R8XaZy67l3BV1uG+8wJMqPB+7ZCWgYVfi15ol7c5T5Xi6QCl519l3 cWFPLG5CW8ln6SZxd236lZm4gYGVkqv5o2wVmA4RSGgV5TYamg0nul5Ojd9lvPb8K70ADi wekC2X0rdd2g7LC/LHKi/0PvesCxMvIXqIXFX4R4d3f67hthsj3zV+lrq0Hu3Q== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1664821370; a=rsa-sha256; cv=none; b=UtBVVOmxGANENb3iNtIZx90P5CemCcPHghQO++3d5p0YYytF+ORJYZ7v3PBmnx5HSVTAOX cgdJh8YpHwpuQLutALhoaLDNCjXVLQd2ha36UTA9ksZ7A2MkufmjEzu9rCz49bh/oIGZZ3 eGXV4o2fcIsksjIuyqVN2IiKMaNz7DAs+/VWCjtohiPexteGR8WOuQR2ePthRrJhAAwazV n5Pa7Ne60lclJ4uEUzrCtam1ndz/PdB3R9W8dKBtOXGLD2SzPQDLKqKmbq2WqJ2O/o8Z2x bpGiXYMBr+jzYUoqY4DCk5gAkLHOVoFZcYPhZdHDJFwpvIO4tvSOz4TQhIejTA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=a9a267c1f7a5a6284398bd7ae6ac0c2a0643ece2 commit a9a267c1f7a5a6284398bd7ae6ac0c2a0643ece2 Author: Johannes Totz AuthorDate: 2022-10-03 18:09:57 +0000 Commit: John Baldwin 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");