From nobody Thu Jul 14 13:50:25 2022 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 4LkG8d36q6z1J42w; Thu, 14 Jul 2022 13:50:25 +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 4LkG8d2Lrdz3xyg; Thu, 14 Jul 2022 13:50:25 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1657806625; 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=VLe/iiNi/m0tZG6OnOXYUIQiKuUJEc/ry6vPZKNDisQ=; b=pXJTDxtwGkTzAmvVFVA1l3aBQG89/Vz0rQuQRZzYvZ6vcgMARoFlKho5gbYOrQJd4M9Sae O1Y3awVyDK56hvg2rXB0cDBxMRpzSbGcgGyguw+h9QHg02rcGrxmyEWRgYgtiAkPSpKBYo g8z9D35NeOb1R1aBoVEms0ueIl7LlnrLlad4a7zbcBCps/gl6j4EGmU8a6Caj/E2lyj0Ij rC7wLy0Zsharw+Qa5niwLxSF1cCXUuyCCjQk3mbS6nL1yM71dBLLxkyvmpqIU1sFAplsh+ nyKFZHNAAAGeoA0TqrrqbqPBuCgLJJE5KAZQ6T7TYbqw1XnMhTlv30igjNYClQ== 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 4LkG8d1QzPz14mF; Thu, 14 Jul 2022 13:50:25 +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 26EDoPvB067818; Thu, 14 Jul 2022 13:50:25 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 26EDoPvB067817; Thu, 14 Jul 2022 13:50:25 GMT (envelope-from git) Date: Thu, 14 Jul 2022 13:50:25 GMT Message-Id: <202207141350.26EDoPvB067817@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: 5687381276d4 - stable/13 - pf: Ensure that pfiio_name is always nul terminated 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: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org 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/stable/13 X-Git-Reftype: branch X-Git-Commit: 5687381276d40484258ee25f1ec39ed0526039c4 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1657806625; 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=VLe/iiNi/m0tZG6OnOXYUIQiKuUJEc/ry6vPZKNDisQ=; b=hNGNuYDZr+SaTQKH1BLkfRC/1wm1WMqfTv7/aaktzNSXF6M65NYTmo/yZxy4yI57NriKgV jD/aOwvQ5YesXHxXK1jnEepQ/HBK0Z05uf3KOJ5mXdiB5cG88JwyhFa1H7WjnsaTzw3p2p QMoBKJiXsm+Sb+VBXYpsYGyY9yzOS+CkN06rigF65Qn1oO8KMDl9WCthO6474az/XiduAA 41wpiEGT0O/hu8+y0Ow6bkrtfqf44mwgTVvlg1E8zdmwSxVW0pmIxlTqMtyx+G7HJd22U8 mmg9yLZfsFa3hYPeSWNw1Tqsr/7sSIaXAm0bmRGCjcQf0eJqGkq1soHY+r5pMg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1657806625; a=rsa-sha256; cv=none; b=TJBxdcJQzhqhpTa/G78qETzUOUcKc+pETyAjCxMF6xSjlpQJsuV7wKxi5BOSqcuVnCAJMm kCMoP6xo2koVRl1wHe0Pc9C19XToupwgYSYAWnFubmb6CBT5IYpwAL9GLYj34PzFakbjG5 Ry6HgtYSQ+uDJ7DHNk3W+cbEOiHv/6m5PsMB6PvpMi09+33vnmYVIg9UDvRfu5YIFs9Yo8 hv5bWIZUnpaTIczpYQZk9fNcKbG56veseN9xb+QU5RzRt232VlJ1nPCXKbCyVWsu4U9tMI 9At3Btr5IaYrrtIAO299mC4E4ZAfYskkFDBEiDl/gStUGi9Uvj8UycJW9JJDsg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=5687381276d40484258ee25f1ec39ed0526039c4 commit 5687381276d40484258ee25f1ec39ed0526039c4 Author: Mark Johnston AuthorDate: 2022-06-30 14:18:50 +0000 Commit: Mark Johnston CommitDate: 2022-07-14 13:49:48 +0000 pf: Ensure that pfiio_name is always nul terminated Reported by: syzkaller Reviewed by: kp Sponsored by: The FreeBSD Foundation (cherry picked from commit bc83b3592241a6bcb18e1537fcd27a8eb342a701) --- sys/netpfil/pf/pf_ioctl.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/sys/netpfil/pf/pf_ioctl.c b/sys/netpfil/pf/pf_ioctl.c index 6820d1f909e5..c765ee65c9bc 100644 --- a/sys/netpfil/pf/pf_ioctl.c +++ b/sys/netpfil/pf/pf_ioctl.c @@ -4729,6 +4729,8 @@ DIOCCHANGEADDR_error: break; } + io->pfiio_name[sizeof(io->pfiio_name) - 1] = '\0'; + bufsiz = io->pfiio_size * sizeof(struct pfi_kif); ifstore = mallocarray(io->pfiio_size, sizeof(struct pfi_kif), M_TEMP, M_WAITOK | M_ZERO); @@ -4744,6 +4746,8 @@ DIOCCHANGEADDR_error: case DIOCSETIFFLAG: { struct pfioc_iface *io = (struct pfioc_iface *)addr; + io->pfiio_name[sizeof(io->pfiio_name) - 1] = '\0'; + PF_RULES_WLOCK(); error = pfi_set_flags(io->pfiio_name, io->pfiio_flags); PF_RULES_WUNLOCK(); @@ -4753,6 +4757,8 @@ DIOCCHANGEADDR_error: case DIOCCLRIFFLAG: { struct pfioc_iface *io = (struct pfioc_iface *)addr; + io->pfiio_name[sizeof(io->pfiio_name) - 1] = '\0'; + PF_RULES_WLOCK(); error = pfi_clear_flags(io->pfiio_name, io->pfiio_flags); PF_RULES_WUNLOCK();