From nobody Thu Oct 28 00:01:38 2021 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 317241811F3E; Thu, 28 Oct 2021 00:01:39 +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 4Hfm1t697Hz3wV2; Thu, 28 Oct 2021 00:01:38 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 A2D7F19B23; Thu, 28 Oct 2021 00:01:38 +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 19S01cih075419; Thu, 28 Oct 2021 00:01:38 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19S01cNU075418; Thu, 28 Oct 2021 00:01:38 GMT (envelope-from git) Date: Thu, 28 Oct 2021 00:01:38 GMT Message-Id: <202110280001.19S01cNU075418@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Jessica Clarke Subject: git: 63d24336fd1a - main - Fix off-by-one error in msdosfs FAT32 volume label copying 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: jrtc27 X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 63d24336fd1aad81a4bdefb11d8c487cee5f88a0 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by jrtc27: URL: https://cgit.FreeBSD.org/src/commit/?id=63d24336fd1aad81a4bdefb11d8c487cee5f88a0 commit 63d24336fd1aad81a4bdefb11d8c487cee5f88a0 Author: Jessica Clarke AuthorDate: 2021-10-28 00:01:00 +0000 Commit: Jessica Clarke CommitDate: 2021-10-28 00:01:00 +0000 Fix off-by-one error in msdosfs FAT32 volume label copying I dropped the + 1 from the other two instances in each file but failed to do so for this one, resulting in a more egregious buffer overread than the one I was fixing (since the read character ended up in the output if there was space). Reported by: Jenkins Fixes: 34fb1c133c5b ("Fix intra-object buffer overread for labeled msdosfs volumes") --- sys/geom/label/g_label_msdosfs.c | 2 +- usr.sbin/fstyp/msdosfs.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/geom/label/g_label_msdosfs.c b/sys/geom/label/g_label_msdosfs.c index 2ba35ff80f51..06d5f2a8e0f0 100644 --- a/sys/geom/label/g_label_msdosfs.c +++ b/sys/geom/label/g_label_msdosfs.c @@ -136,7 +136,7 @@ g_label_msdosfs_taste(struct g_consumer *cp, char *label, size_t size) if (strncmp(pfat32_bsbpb->BS_VolLab, LABEL_NO_NAME, sizeof(pfat32_bsbpb->BS_VolLab)) != 0) { copysize = MIN(size - 1, - sizeof(pfat32_bsbpb->BS_VolLab) + 1); + sizeof(pfat32_bsbpb->BS_VolLab)); memcpy(label, pfat32_bsbpb->BS_VolLab, copysize); label[copysize] = '\0'; goto endofchecks; diff --git a/usr.sbin/fstyp/msdosfs.c b/usr.sbin/fstyp/msdosfs.c index ce745869edba..47d2383fbc8f 100644 --- a/usr.sbin/fstyp/msdosfs.c +++ b/usr.sbin/fstyp/msdosfs.c @@ -104,7 +104,7 @@ fstyp_msdosfs(FILE *fp, char *label, size_t size) if (strncmp(pfat32_bsbpb->BS_VolLab, LABEL_NO_NAME, sizeof(pfat32_bsbpb->BS_VolLab)) != 0) { copysize = MIN(size - 1, - sizeof(pfat32_bsbpb->BS_VolLab) + 1); + sizeof(pfat32_bsbpb->BS_VolLab)); memcpy(label, pfat32_bsbpb->BS_VolLab, copysize); label[copysize] = '\0'; goto endofchecks;