From nobody Tue Jun 30 17:21:58 2026 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 4gqVLv2bbVz6jZ5S for ; Tue, 30 Jun 2026 17:21:59 +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 "YR1" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gqVLt500Lz3t0f for ; Tue, 30 Jun 2026 17:21:58 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1782840118; 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=TA8EoOgTBrGxVYGwcy5jDjaFmf2ccc6zoOM3x8hKmuU=; b=IkH/5hVC4tJUNrdIAhsb46fYI2Ld36oggSNC355YzzzyMezIcVGg/2yRTIJpkv45ozL71R B3+8Z7EOGGrNrwqi8VvnPTt/11ml5kiEs2Ac9jFNJWVKAkkXUMmNKxo+nE/sT4bZmvIsvg oNS92BwKwQAhS4Int4/DqB/UPTcpjdCbL2auv/Gdit972JQJowVpePqkvpbZIwO6HXGt+m 2UnNas4ChzW6lDwYcEAgwtRQhLq5VmDqYe6teFNyaPqLlNQfJEiZ5TxmOm+ftTOstxPLnv Hw/k3yig3u8Y434LUCu6tU17+TVLT49ZuISRtQDcETviYd11qv7bisGdrVAoTw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1782840118; a=rsa-sha256; cv=none; b=tA292kJ/5jmvGNdAOgH+JtD5F6pYCp+fUSGUMxObS+Ak+9eMbmfGiS1vXz00624WW09hJ+ hsiGRS9q3T4eITjpboH3R5qxoDxH7TiddwfRv33l0l2PsiSMWzaKWPDvdLNfwbdb0vVx0X p23PZYQTCChmt80uNDZWCGs/NSWyIdPi+2BGEeY7kpTIi0YygKPDL38b6T2Lg+suVjdWJP kYw57oGe81pPMRs3Fim03JIrh5/NzZkJJOELsVGlY9rnVnPDIw6QkIZxRJDInebQB0qc32 PxOMI5mjDFa4j86lJ4mDlTLkwrIGGgxwFXJhycNmUNWLX+6IU06YhN8Xjklryg== 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=1782840118; 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=TA8EoOgTBrGxVYGwcy5jDjaFmf2ccc6zoOM3x8hKmuU=; b=ci3QGBwY5GKGFlw+YfBQy0TPZwgdZpKcEIRPNmV7fg2nnaYAmJWthpCKto9RoM8IiN8vfa vWj8B39zP6EU1HuQk+PpXTMAkYtZk1XjhLNt2j4GVt304TEWgLCr4JlLISeOFtLflczxFJ ilX7bH267Z0Z8sr+7LkDEq4JBPSqXhQN19h8FTcSUEHWDePt0MjLIshqZw441RXIqWPhEy AxBD1fcuc8zotIVgjBCvuaQiYLymP+y9ybc0gDovwqoARWA4uWIID6DIHmCxUkpehLOpBy 5JMrMalqv31PXU/6W8tcdVJn52sT0cjz8OIcBowto2YDJDWqQkDyvdcSSHvFRw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gqVLt3FPGztsq for ; Tue, 30 Jun 2026 17:21:58 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 46083 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Tue, 30 Jun 2026 17:21:58 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: 1b96804ba50d - releng/15.1 - tests/libalias: Add a regression test for an alias_smedia bug 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: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@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: 1b96804ba50d91ccb80ebef87e67a466dd57c9ed Auto-Submitted: auto-generated Date: Tue, 30 Jun 2026 17:21:58 +0000 Message-Id: <6a43fb36.46083.70539612@gitrepo.freebsd.org> The branch releng/15.1 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=1b96804ba50d91ccb80ebef87e67a466dd57c9ed commit 1b96804ba50d91ccb80ebef87e67a466dd57c9ed Author: Mark Johnston AuthorDate: 2026-06-22 17:25:56 +0000 Commit: Mark Johnston CommitDate: 2026-06-29 19:16:40 +0000 tests/libalias: Add a regression test for an alias_smedia bug Approved by: so Security: FreeBSD-SA-26:41.libalias Security: CVE-2026-49420 Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D57747 --- tests/sys/netinet/libalias/Makefile | 4 ++ tests/sys/netinet/libalias/smedia.c | 74 +++++++++++++++++++++++++++++++++++++ 2 files changed, 78 insertions(+) diff --git a/tests/sys/netinet/libalias/Makefile b/tests/sys/netinet/libalias/Makefile index 43bef996fae7..95816444a6d2 100644 --- a/tests/sys/netinet/libalias/Makefile +++ b/tests/sys/netinet/libalias/Makefile @@ -3,6 +3,10 @@ PACKAGE= tests TESTSDIR= ${TESTSBASE}/sys/netinet/libalias BINDIR= ${TESTSDIR} +PLAIN_TESTS_C+= smedia + +LIBADD.smedia+= sbuf + ATF_TESTS_C+= 1_instance \ 2_natout \ 3_natin \ diff --git a/tests/sys/netinet/libalias/smedia.c b/tests/sys/netinet/libalias/smedia.c new file mode 100644 index 000000000000..e181a7a538af --- /dev/null +++ b/tests/sys/netinet/libalias/smedia.c @@ -0,0 +1,74 @@ +/* + * Copyright (c) 2026 The FreeBSD Foundation + * + * This software was developed by Mark Johnston under sponsorship from + * the FreeBSD Foundation. + * + * SPDX-License-Identifier: BSD-2-Clause + */ + +/* + * A minimal regression test for a buffer overflow in alias_rtsp_out(). + */ + +#include +#include + +#include +#include +#include +#include + +#include +#include + +#include + +int +main(void) +{ + uint8_t *packet; + struct ip ip; + struct tcphdr tcp; + struct sbuf sb; + struct libalias *la; + + sbuf_new(&sb, NULL, 0, SBUF_AUTOEXTEND); + sbuf_printf(&sb, "SETUP rtsp://example.com/media.mp4 RTSP/1.0\r\n"); + sbuf_printf(&sb, "CSeq: 1\r\n"); + sbuf_printf(&sb, "Transport: RTP/AVP;unicast;"); + for (int i = 0; i < 200; i++) + sbuf_printf(&sb, "client_port=%d-%d;", 2 * i, 2 * i + 1); + sbuf_printf(&sb, "\r\n\r\n"); + sbuf_finish(&sb); + + memset(&tcp, 0, sizeof(tcp)); + tcp.th_sport = htons(1234); + tcp.th_dport = htons(554); + tcp.th_off = 5; + + memset(&ip, 0, sizeof(ip)); + ip.ip_v = IPVERSION; + ip.ip_hl = sizeof(ip) / 4; + ip.ip_len = htons(sizeof(ip) + sizeof(tcp) + sbuf_len(&sb)); + ip.ip_id = htons(1); + ip.ip_ttl = 64; + ip.ip_p = IPPROTO_TCP; + ip.ip_src.s_addr = inet_addr("127.0.0.1"); + ip.ip_dst.s_addr = inet_addr("127.0.0.2"); + + packet = malloc(sizeof(ip) + sizeof(tcp) + sbuf_len(&sb)); + memcpy(packet, &ip, sizeof(ip)); + memcpy(packet + sizeof(ip), &tcp, sizeof(tcp)); + memcpy(packet + sizeof(ip) + sizeof(tcp), sbuf_data(&sb), + sbuf_len(&sb)); + + la = LibAliasInit(NULL); + LibAliasSetAddress(la, + (struct in_addr){.s_addr = inet_addr("127.0.0.1")}); + if (LibAliasOut(la, packet, sizeof(ip) + sizeof(tcp) + sbuf_len(&sb)) != + PKT_ALIAS_OK) + return (1); + LibAliasUninit(la); + return (0); +}