From nobody Fri Jul 18 16:06:56 2025 X-Original-To: dev-commits-src-main@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 4bkF6n2lDfz62VBb; Fri, 18 Jul 2025 16:07:13 +0000 (UTC) (envelope-from asomers@gmail.com) Received: from mail-ej1-f52.google.com (mail-ej1-f52.google.com [209.85.218.52]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "WR4" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bkF6m6dVlz3n8N; Fri, 18 Jul 2025 16:07:12 +0000 (UTC) (envelope-from asomers@gmail.com) Authentication-Results: mx1.freebsd.org; none Received: by mail-ej1-f52.google.com with SMTP id a640c23a62f3a-ae36dc91dc7so379575266b.2; Fri, 18 Jul 2025 09:07:12 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1752854830; x=1753459630; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=OSXYdoWzeY6obGtyf3PjXszuefbkrbfDNF9MmOSsHw4=; b=UXkBdyeD3TERudLQGnDSy45XBZJ9ABLY+YgD81be1uhk92s4hHvGSyw8B7Vq9jYvpI p55HAgFyIWv6Y3mREvaa4+JdSXmRGD9qfP08nvufqFMK3Hme3ZMxMqyxIGpVQaP0FYMB 2IhEPCsHOANhcQXmbKKN2iHgX4dUDcPt8KjqV8TAg0iD5ST0E38Wv4dle16DqtkNW43m GZi3r47+K1eOkS1TarOCOml++/mGds5U7HucbxB+W7b9ef1z4KnfNH5yi2yDCBsZ3nqb 79k2bWfOmXGE8CpFJLRs4ZG/qP3vT+nxgnamScnRXt7GtScqswI6LPyLOKlfyG/AML0g 44Iw== X-Forwarded-Encrypted: i=1; AJvYcCWHUs6Y5itDlyV8bXVAIAyeP2G716Lp0JznaIc+m3jLSwPH+lmA6C/UiRYdCGIrfmLrMxQN9yEjYr9GGVNN/xFoNEkuALE=@freebsd.org, AJvYcCXtGnZ2z2IEWVh5woO6iXXAU+pWoaYGbxddvLwCblvggxxNZeai/rmDbWuyree4umw/LulLdLF6FYtNoGJoogPmLwRk@freebsd.org X-Gm-Message-State: AOJu0Yw3fOBRNpiwUEDiBA5SEoQkE/jRvHt2GQ+xjwdF0XS0yLnXELFU /Zvm9LTo+JZLcvszvdrsC7Lf6sMH0l436LtogMUe20LbDYyysFGXkKSOGoRrcQtzAVhBNH43105 kEMhpmJ8Xg7Gf4/Tms60axxP4MWVAWoYcnQ== X-Gm-Gg: ASbGnctvwnErOEcXnMHAQGpWDUE+0vOfljwxJAw3A2JUQ9pY/4zagjCeY0ZdVZrQSaa rSmhyvEdtzbcszRkpe2Y+H1+CkCZP03yU4wwEUgFOjVtLNRbJg1fXXasyIVcpff5QnVtVwDuvU9 UziZZdL9Cky5AXqnF7czQtqV2kTmrrxa7utECUTepGGl4HptkECsqJtmrt3aC8aVvmi+WqJsbbL Mf3xoFwAz8g9rYn4A== X-Google-Smtp-Source: AGHT+IEAhfXjaiw1MCJWwktpP879ACf6ouoq9kNRu78tA5mef0BGnGu0K6BaPySaekuqTMD3nQCL5Ym4JvGVUUWJVVc= X-Received: by 2002:a17:906:9f85:b0:ae6:f15e:88c4 with SMTP id a640c23a62f3a-ae9cdda86e5mr1203628566b.10.1752854829647; Fri, 18 Jul 2025 09:07:09 -0700 (PDT) List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 References: <202507172154.56HLsGLL095197@gitrepo.freebsd.org> In-Reply-To: <202507172154.56HLsGLL095197@gitrepo.freebsd.org> From: Alan Somers Date: Fri, 18 Jul 2025 10:06:56 -0600 X-Gm-Features: Ac12FXyxud1IhKDf_9krqT38geWJjKJti6ANg2BmnZhIyF5x03ZConqHtwwV2rg Message-ID: Subject: Re: git: 29af6d2e2ec9 - main - msdosfs: replace '/' in direntries with '?' To: Konstantin Belousov Cc: src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Content-Type: multipart/alternative; boundary="00000000000076cc48063a36510e" X-Rspamd-Queue-Id: 4bkF6m6dVlz3n8N X-Spamd-Bar: ---- X-Rspamd-Pre-Result: action=no action; module=replies; Message is reply to one we originated X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[]; ASN(0.00)[asn:15169, ipnet:209.85.128.0/17, country:US] --00000000000076cc48063a36510e Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Should we move this logic up into kern_getdirentries? msdosfs is not the only file system vulnerable to this problem. On Thu, Jul 17, 2025 at 3:54=E2=80=AFPM Konstantin Belousov wrote: > The branch main has been updated by kib: > > URL: > https://cgit.FreeBSD.org/src/commit/?id=3D29af6d2e2ec9fe8df7cf1e1a0bf3597= 028831b18 > > commit 29af6d2e2ec9fe8df7cf1e1a0bf3597028831b18 > Author: Konstantin Belousov > AuthorDate: 2025-07-17 01:12:05 +0000 > Commit: Konstantin Belousov > CommitDate: 2025-07-17 21:53:54 +0000 > > msdosfs: replace '/' in direntries with '?' > > PR: 288266 > Reported by: Robert Morris > Reviewed by: markj > Sponsored by: The FreeBSD Foundation > MFC after: 1 week > Differential revision: https://reviews.freebsd.org/D51365 > --- > sys/fs/msdosfs/msdosfs_conv.c | 11 +++++++++-- > 1 file changed, 9 insertions(+), 2 deletions(-) > > diff --git a/sys/fs/msdosfs/msdosfs_conv.c b/sys/fs/msdosfs/msdosfs_conv.= c > index da4848169173..208b64930e61 100644 > --- a/sys/fs/msdosfs/msdosfs_conv.c > +++ b/sys/fs/msdosfs/msdosfs_conv.c > @@ -797,19 +797,24 @@ mbsadjpos(const char **instr, size_t inlen, size_t > outlen, int weight, int flag, > static u_char * > dos2unixchr(u_char *outbuf, const u_char **instr, size_t *ilen, int > lower, struct msdosfsmount *pmp) > { > - u_char c, *outp; > - size_t len, olen; > + u_char c, *outp, *outp1; > + size_t i, len, olen; > > outp =3D outbuf; > if (pmp->pm_flags & MSDOSFSMNT_KICONV && msdosfs_iconv) { > olen =3D len =3D 4; > > + outp1 =3D outp; > if (lower & (LCASE_BASE | LCASE_EXT)) > msdosfs_iconv->convchr_case(pmp->pm_d2u, (const > char **)instr, > ilen, (char **)&outp, > &olen, KICONV_LOWER); > else > msdosfs_iconv->convchr(pmp->pm_d2u, (const char > **)instr, > ilen, (char **)&outp, &olen)= ; > + for (i =3D 0; i < outp - outp1; i++) { > + if (outp1[i] =3D=3D '/') > + outp1[i] =3D '?'; > + } > len -=3D olen; > > /* > @@ -826,6 +831,8 @@ dos2unixchr(u_char *outbuf, const u_char **instr, > size_t *ilen, int lower, struc > c =3D dos2unix[c]; > if (lower & (LCASE_BASE | LCASE_EXT)) > c =3D u2l[c]; > + if (c =3D=3D '/') > + c =3D '?'; > *outp++ =3D c; > outbuf[1] =3D '\0'; > } > --00000000000076cc48063a36510e Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Should we move this logic up into kern_getdirentries?= =C2=A0 msdosfs is not the only file system vulnerable to this problem.
On Thu, Jul 17, 2025 at 3:54=E2=80=AFPM Konstantin Belouso= v <kib@freebsd.org> wrote:
=
The branch main has= been updated by kib:

URL: https://cgit.= FreeBSD.org/src/commit/?id=3D29af6d2e2ec9fe8df7cf1e1a0bf3597028831b18
commit 29af6d2e2ec9fe8df7cf1e1a0bf3597028831b18
Author:=C2=A0 =C2=A0 =C2=A0Konstantin Belousov <kib@FreeBSD.org>
AuthorDate: 2025-07-17 01:12:05 +0000
Commit:=C2=A0 =C2=A0 =C2=A0Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2025-07-17 21:53:54 +0000

=C2=A0 =C2=A0 msdosfs: replace '/' in direntries with '?'
=C2=A0 =C2=A0 PR:=C2=A0 =C2=A0 =C2=A0288266
=C2=A0 =C2=A0 Reported by:=C2=A0 =C2=A0 Robert Morris <rtm@lcs.mit.edu>
=C2=A0 =C2=A0 Reviewed by:=C2=A0 =C2=A0 markj
=C2=A0 =C2=A0 Sponsored by:=C2=A0 =C2=A0The FreeBSD Foundation
=C2=A0 =C2=A0 MFC after:=C2=A0 =C2=A0 =C2=A0 1 week
=C2=A0 =C2=A0 Differential revision:=C2=A0 https://reviews.freebsd= .org/D51365
---
=C2=A0sys/fs/msdosfs/msdosfs_conv.c | 11 +++++++++--
=C2=A01 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/sys/fs/msdosfs/msdosfs_conv.c b/sys/fs/msdosfs/msdosfs_conv.c<= br> index da4848169173..208b64930e61 100644
--- a/sys/fs/msdosfs/msdosfs_conv.c
+++ b/sys/fs/msdosfs/msdosfs_conv.c
@@ -797,19 +797,24 @@ mbsadjpos(const char **instr, size_t inlen, size_t ou= tlen, int weight, int flag,
=C2=A0static u_char *
=C2=A0dos2unixchr(u_char *outbuf, const u_char **instr, size_t *ilen, int l= ower, struct msdosfsmount *pmp)
=C2=A0{
-=C2=A0 =C2=A0 =C2=A0 =C2=A0u_char c, *outp;
-=C2=A0 =C2=A0 =C2=A0 =C2=A0size_t len, olen;
+=C2=A0 =C2=A0 =C2=A0 =C2=A0u_char c, *outp, *outp1;
+=C2=A0 =C2=A0 =C2=A0 =C2=A0size_t i, len, olen;

=C2=A0 =C2=A0 =C2=A0 =C2=A0 outp =3D outbuf;
=C2=A0 =C2=A0 =C2=A0 =C2=A0 if (pmp->pm_flags & MSDOSFSMNT_KICONV &a= mp;& msdosfs_iconv) {
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 olen =3D len =3D 4;=

+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0outp1 =3D outp;
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 if (lower & (LC= ASE_BASE | LCASE_EXT))
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 msdosfs_iconv->convchr_case(pmp->pm_d2u, (const char **)in= str,
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 ilen, (char **)&outp, &olen, KICONV_LOW= ER);
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 else
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 msdosfs_iconv->convchr(pmp->pm_d2u, (const char **)instr,<= br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0ilen, (char **)&outp, &olen);
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0for (i =3D 0; i <= ; outp - outp1; i++) {
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0if (outp1[i] =3D=3D '/')
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0outp1[i] =3D '?';
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0}
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 len -=3D olen;

=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 /*
@@ -826,6 +831,8 @@ dos2unixchr(u_char *outbuf, const u_char **instr, size_= t *ilen, int lower, struc
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 c =3D dos2unix[c];<= br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 if (lower & (LC= ASE_BASE | LCASE_EXT))
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 c =3D u2l[c];
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0if (c =3D=3D '/= ')
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0c =3D '?';
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 *outp++ =3D c;
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 outbuf[1] =3D '= \0';
=C2=A0 =C2=A0 =C2=A0 =C2=A0 }
--00000000000076cc48063a36510e--