From nobody Thu Jun 30 14:31:31 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 158EC87237B; Thu, 30 Jun 2022 14:31:32 +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 4LYgkX068mz4tcB; Thu, 30 Jun 2022 14:31:32 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1656599492; 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=YRKfJ7pB99ACxqQbLmezaV2yqPXceBhNWnKZZy94P7E=; b=PCHBnxcBb8BYBGw3oWSTHIlUphs1AMjm4dgdgCm6hH5cESxp1DzR0hBfDcxa0haIa6D49h DutwxJ7u7zp/Wb0p3CPwomTOxBw+OTOG9LDe7Hv5yyoqXdpH/GLxmbTlTDWHfZT2F3UP+m nmalZpb+8Be5faGL+ys4snovV/NU6wXP+kljla61gHX4Lo69tX0vqq4eRbDSJXstmCqFA7 8kUA4pmXB+4S3xzWdtvQaLygNDuwxUbQRAqaNDVXqicbO99/JxEAIO62N+0JeTbJy/6yTE cMOHab0rkkYTLA1NBt3SvI3eWEjxnTdZkMVdIeZj8/e1+0TpgoNTnLcuMY6YiA== 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 D8D4C207; Thu, 30 Jun 2022 14:31:31 +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 25UEVVTS074383; Thu, 30 Jun 2022 14:31:31 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 25UEVVhc074382; Thu, 30 Jun 2022 14:31:31 GMT (envelope-from git) Date: Thu, 30 Jun 2022 14:31:31 GMT Message-Id: <202206301431.25UEVVhc074382@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: bc83b3592241 - main - pf: Ensure that pfiio_name is always nul terminated 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: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: bc83b3592241a6bcb18e1537fcd27a8eb342a701 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1656599492; 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=YRKfJ7pB99ACxqQbLmezaV2yqPXceBhNWnKZZy94P7E=; b=snAY7YDWafIBc2brZJQRmZA0IHYfSL/lvvIUwBrzdtd2XKY5TyQH8ltIHQaXQlDWWvXCyr xBDB1CU1MujMC0yAS+oDolYrsZXCY3SXaOAqgARrv03vBZDqGJ59yoRXpYmC6OQMp+fDQO Jso1WkDU49kJdeWVCiuCbp1f8MXcKs0hM+Sv5qdPzR1fVPOZ1gxCRgXuFdhVVhxYH1G7vu joYKwD9bUPkQGDDnViP/ggrBTj2IzLnf1TgK8F3lpLvElvy4lb+WcMwUTezMo9RqSrFCSr AH9NSTaX/7WovlRZMWUO1uUzc3aE/6TgetrhdDcxHx0YQsaeFjMhb/hcF5kYkg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1656599492; a=rsa-sha256; cv=none; b=FDhbxFS8fKJMgI0VJFFXNf3ThqCpUMn/aa7O+1kCpaO8ByTMDPnEZU0a62oBsDxg1ArI6+ erlECedY2NEgks6/no0J9Y/nX2W3e1DBjbGXCDiXp3w3ZsUtXSlPasmndU0zI+LY7rm93g s4i+qKvpDT9tjmaKljMnXuZ9zV8CzdZejD3nuQas479L9rNA5M0KqEf9B3Lx70NJM5AAl0 KG92u6MpY/i5rdGooWgJ00aCODIS52gyrJExnN33CiAkN4Xu99r1u9YllfKTk1IhlXqSwC d/WVL5BV2eO3ZvcbUn+t2bfPPhBdGIfZO9jvzjB4Gb6QZjuS8AxBTh9R4/D6Qg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=bc83b3592241a6bcb18e1537fcd27a8eb342a701 commit bc83b3592241a6bcb18e1537fcd27a8eb342a701 Author: Mark Johnston AuthorDate: 2022-06-30 14:18:50 +0000 Commit: Mark Johnston CommitDate: 2022-06-30 14:31:26 +0000 pf: Ensure that pfiio_name is always nul terminated Reported by: syzkaller Reviewed by: kp MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D35660 --- 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 c50369a23aaf..3108536b58ab 100644 --- a/sys/netpfil/pf/pf_ioctl.c +++ b/sys/netpfil/pf/pf_ioctl.c @@ -5584,6 +5584,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); @@ -5599,6 +5601,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(); @@ -5608,6 +5612,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();