From nobody Tue Jun 9 19:19:15 2026 X-Original-To: dev-commits-src-branches@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 4gZdxw0LZBz6gVJj for ; Tue, 09 Jun 2026 19:19:16 +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 "R13" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gZdxv4BPTz3PhQ for ; Tue, 09 Jun 2026 19:19:15 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1781032755; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=m1OQF+EYw1w9aMARbC2Q1hz0culhU7RAr2fgk5Ntzo4=; b=De1nWlU9J4r9Krniz5wGsqNh/145rYvCRPMtT+H+R3AxL9u8pHb85Gd9MCYBn5X4GME2bT kVFo5jfTYkhmqcJR8vTjZbdpPJ/+NJVqnlq+C74qfSRhNr1Ph3swhxF9M1HwfL3vPRdpDX CfI5XXecyG1Kqx64jFnHuhWdRFbh9eXBcwxR4uwX2o3P4e9keNn9xBdLezcsGOimJaqYA7 gxYd9baWsuDsMQ52W/x5OImwf9MkQ9CPo9zt4s+/MYjY+6Ls0Cg6Fl1b24eDwDZL/e0v1V Ez/gXooOmQBM8ie/MEQeqaTO8WUvcp91SkBSSa/6rjtnCG7luhYK27qQxNNrjw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1781032755; a=rsa-sha256; cv=none; b=MPMXe0Dc4wlizsKc1eMsJaVwNGhd2TL6a1BWMfCea81Fw5yh6+NQcu3RKy+dHzJY8zne/z rFYEsKSKZjEePPOrJIbSViXqCLMxxO10a5/Yj7K45sJDuPZeJZaWNRF44USpcYlNg/FuSS kvL22ilMw+XU1nCdOmvSUuE+eVLFoSe3ZANAUVCHCdmjfIf3PYh5gcCs0n6D5f8adrbfLw nlQZQhiE0FtWFfdeBzIbLRQ9NUdAGh34+T07yB863DhDFVWGznY++/fxjQn9mSI0qZkfdZ rfcV9sGvPB9b5ir+dulNTmLL/SfMdXbIZ1Xbl86A9yBoDaiJUDGVoQOYSR9ZOg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1781032755; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=m1OQF+EYw1w9aMARbC2Q1hz0culhU7RAr2fgk5Ntzo4=; b=QNc27Z3Ik+oSxhouU2FK6gK2a6EFCidvUZg7kTGly3pqluXmtRIPwkABO0leafwR0fFnzR f0IJiDo2nIkDubHAZS0LvnGyaPLfNIcXM69pRD0Fft8grW5O9gHhNBgTSm0zT3rGysWWPX R8+EDBUqTRhzN2MRzlO3WbFzKe+tIS13ZunqTafiEQ0YXdoskhY0WcgLNgCj9yCc1tGii0 sso109UU8x81WCujGu9RZ59NPFPVQqaxBfDL36nP0zI+4VYZJ+b7P0+Uirv7iK+f60H9gl 6sPlySBdWSNbF6ZjTwTNHGGuTH4EAjSx07mx9uBLKJQkyAoSqlxFu+9+MbOZ6g== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gZdxv3XxQzp1T for ; Tue, 09 Jun 2026 19:19:15 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 3ea6e by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Tue, 09 Jun 2026 19:19:15 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org Cc: Ed Maste From: Mark Johnston Subject: git: 799e830134d5 - releng/14.4 - vt: Avoid integer overflow in CONS_HISTORY ioctl List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-branches@freebsd.org Sender: owner-dev-commits-src-branches@FreeBSD.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/releng/14.4 X-Git-Reftype: branch X-Git-Commit: 799e830134d51209defe76c0298080a86c62b996 Auto-Submitted: auto-generated Date: Tue, 09 Jun 2026 19:19:15 +0000 Message-Id: <6a286733.3ea6e.15883dfc@gitrepo.freebsd.org> The branch releng/14.4 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=799e830134d51209defe76c0298080a86c62b996 commit 799e830134d51209defe76c0298080a86c62b996 Author: Ed Maste AuthorDate: 2026-05-26 16:19:47 +0000 Commit: Mark Johnston CommitDate: 2026-06-08 13:21:34 +0000 vt: Avoid integer overflow in CONS_HISTORY ioctl Approved by: so Security: FreeBSD-SA-26:34.vt Security: CVE-2026-49416 Reviewed by: markj, vexeduxr Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D57250 (cherry picked from commit 0ae946e7223df5ef3f7980af1d774d7f593f6421) (cherry picked from commit deaaddf1d3c4283649945553ad7e3208c8424308) (cherry picked from commit b5a4f4bfbc95d5d5361da708728f7f4a6db2ee60) --- sys/dev/vt/vt_buf.c | 9 ++++----- sys/dev/vt/vt_core.c | 6 ++++-- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/sys/dev/vt/vt_buf.c b/sys/dev/vt/vt_buf.c index ea27ea8a5ebf..0fd301bb662a 100644 --- a/sys/dev/vt/vt_buf.c +++ b/sys/dev/vt/vt_buf.c @@ -500,7 +500,6 @@ vtbuf_grow(struct vt_buf *vb, const term_pos_t *p, unsigned int history_size) { term_char_t *old, *new, **rows, **oldrows, **copyrows, *row, *oldrow; unsigned int w, h, c, r, old_history_size; - size_t bufsize, rowssize; int history_full; const teken_attr_t *a; term_char_t ch; @@ -511,10 +510,10 @@ vtbuf_grow(struct vt_buf *vb, const term_pos_t *p, unsigned int history_size) history_size = MAX(history_size, p->tp_row); /* Allocate new buffer. */ - bufsize = history_size * p->tp_col * sizeof(term_char_t); - new = malloc(bufsize, M_VTBUF, M_WAITOK | M_ZERO); - rowssize = history_size * sizeof(term_pos_t *); - rows = malloc(rowssize, M_VTBUF, M_WAITOK | M_ZERO); + new = mallocarray(history_size, p->tp_col * sizeof(term_char_t), + M_VTBUF, M_WAITOK | M_ZERO); + rows = mallocarray(history_size, sizeof(term_pos_t *), M_VTBUF, + M_WAITOK | M_ZERO); /* Toggle it. */ VTBUF_LOCK(vb); diff --git a/sys/dev/vt/vt_core.c b/sys/dev/vt/vt_core.c index 5cf45a7c61b2..6e6f58d9e215 100644 --- a/sys/dev/vt/vt_core.c +++ b/sys/dev/vt/vt_core.c @@ -41,6 +41,7 @@ #include #include #include +#include #include #include #include @@ -2771,8 +2772,9 @@ skip_thunk: /* XXX */ return (0); case CONS_HISTORY: - if (*(int *)data < 0) - return EINVAL; + if (*(int *)data < 0 || + *(int *)data > UINT_MAX / USHRT_MAX / sizeof(term_char_t)) + return (EINVAL); if (*(int *)data != vw->vw_buf.vb_history_size) vtbuf_sethistory_size(&vw->vw_buf, *(int *)data); return (0);