From nobody Tue Jun 9 19:20:14 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 4gZdz326X8z6gVXy for ; Tue, 09 Jun 2026 19:20:15 +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 4gZdz25qlDz3R9t for ; Tue, 09 Jun 2026 19:20:14 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1781032814; 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=s3Ab7Myl88cBW+gY4zi+MDlAIg0+en2kGH9A4CeBC10=; b=xbH8OivzpcgRlzmPV0GR6rALcAi1uGmVG7bjGcdb6AR6rfgV33b48e6dd3u6o1hcBnrKY2 kTKOYisme5DiskDxiokDGWHB8euNGUFx2dtOdLB87LPcDRy/vnnHmb4XjcwNmMWLshfboy B/8hEhjZ2PJ29ryXc2nVWY8x/EBY+QOCuwhIQK0j/VGccymFZbvwY7qtGpLMxkZsksLsac NKZd+0ft7t9rtgjC0B9g4aN3eRWmmMhsd7xJ9yYcpz/8+42MOe/UIpdAOWiFhc98P2nh+6 QduFxTUcBdhmN3tcpQf9WcZq0fnNMWm6wZedoSGQLstHc32ogl8586VHOGRZXA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1781032814; a=rsa-sha256; cv=none; b=jv9TPiYfGp1zcoK/bJMF6nFkVfhVQaAugpVXymn8p7GyM53aMtS5C/kGinVSyXjt42Y0ZE GgHJFHSMdI8YMMKAVmxz4LlRKP5HbPMziBWPff79/ZINvGh43Q36JVDjNoWMir3kAj9XBR OQRAoFkUFWZDlXTuMf9tMoWINFsJ6ECP8vBUbdXqdFfHZol/ZM2okTgJa8CrmP0a5zbQhh w6npkOKnKjlZqc+mpBzBj/eYbxfwhtcjYonCjPA+3E+ecyvLkr9T9/1VzPXUk7TNFtD2Ly sEMkCxjkP4nCJ2tJWfk7VftNr+/Qbi/9sPfGCnDX+mqZeCJI6YTxQ7wy0EBQKQ== 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=1781032814; 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=s3Ab7Myl88cBW+gY4zi+MDlAIg0+en2kGH9A4CeBC10=; b=PzNdqxC+DPPBkkdEBMAhDJHRFPI6cpqeRYBLLttzjSjwGVZK8kz8Zwz660EwS/HZmVHIOR xo8P0F3erwCX0JxybQg2+uiCWvf0uhiyTCPpjNPJfCV3e5PmHZ7tVYHDwzS9aUcMrAmoCZ 0BHHX2mLM0Zi6dBLUqU0BIGKWg/weJDJmIuesjra88EUPD7YhnI3WAYcx05oFGfhpt5ihZ 4VztZYfqjiNCuOKSgDBe2jYG8EblXPqh1Lm/R5iwpJRCvbRF0w/qK7iAKEZx1uvujrfxQz cWkwbnuJa1W+clcNkhjuW+2cAewakLJyMT2pazrXPEMn7MpthufEgRq0nbsw/w== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gZdz25CtvznGK for ; Tue, 09 Jun 2026 19:20:14 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 3d6e4 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Tue, 09 Jun 2026 19:20:14 +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: 8ed11b21e544 - releng/15.1 - 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/15.1 X-Git-Reftype: branch X-Git-Commit: 8ed11b21e54417a450c64914a3898ce75c243c7f Auto-Submitted: auto-generated Date: Tue, 09 Jun 2026 19:20:14 +0000 Message-Id: <6a28676e.3d6e4.7ec97a90@gitrepo.freebsd.org> The branch releng/15.1 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=8ed11b21e54417a450c64914a3898ce75c243c7f commit 8ed11b21e54417a450c64914a3898ce75c243c7f Author: Ed Maste AuthorDate: 2026-05-26 16:19:47 +0000 Commit: Mark Johnston CommitDate: 2026-06-09 03:00:15 +0000 vt: Avoid integer overflow in CONS_HISTORY ioctl Approved by: re (cperciva) 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) --- 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 e1e4ebc23491..43657fcecbdc 100644 --- a/sys/dev/vt/vt_buf.c +++ b/sys/dev/vt/vt_buf.c @@ -499,7 +499,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; @@ -510,10 +509,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 8360f0b80fb5..922b44028a23 100644 --- a/sys/dev/vt/vt_core.c +++ b/sys/dev/vt/vt_core.c @@ -40,6 +40,7 @@ #include #include #include +#include #include #include #include @@ -2798,8 +2799,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);