Date: Fri, 18 Jul 2025 10:06:56 -0600 From: Alan Somers <asomers@freebsd.org> To: Konstantin Belousov <kib@freebsd.org> Cc: src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Subject: Re: git: 29af6d2e2ec9 - main - msdosfs: replace '/' in direntries with '?' Message-ID: <CAOtMX2hdWCAzhieDJkzWZf-5bdw-%2Bycq0m_t0fdrqag11hPW0A@mail.gmail.com> In-Reply-To: <202507172154.56HLsGLL095197@gitrepo.freebsd.org>
index | next in thread | previous in thread | raw e-mail
[-- Attachment #1 --] 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 PM Konstantin Belousov <kib@freebsd.org> wrote: > The branch main has been updated by kib: > > URL: > https://cgit.FreeBSD.org/src/commit/?id=29af6d2e2ec9fe8df7cf1e1a0bf3597028831b18 > > commit 29af6d2e2ec9fe8df7cf1e1a0bf3597028831b18 > Author: Konstantin Belousov <kib@FreeBSD.org> > AuthorDate: 2025-07-17 01:12:05 +0000 > Commit: Konstantin Belousov <kib@FreeBSD.org> > CommitDate: 2025-07-17 21:53:54 +0000 > > msdosfs: replace '/' in direntries with '?' > > PR: 288266 > Reported by: Robert Morris <rtm@lcs.mit.edu> > 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 = outbuf; > if (pmp->pm_flags & MSDOSFSMNT_KICONV && msdosfs_iconv) { > olen = len = 4; > > + outp1 = 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 = 0; i < outp - outp1; i++) { > + if (outp1[i] == '/') > + outp1[i] = '?'; > + } > len -= olen; > > /* > @@ -826,6 +831,8 @@ dos2unixchr(u_char *outbuf, const u_char **instr, > size_t *ilen, int lower, struc > c = dos2unix[c]; > if (lower & (LCASE_BASE | LCASE_EXT)) > c = u2l[c]; > + if (c == '/') > + c = '?'; > *outp++ = c; > outbuf[1] = '\0'; > } > [-- Attachment #2 --] <div dir="ltr"><div>Should we move this logic up into kern_getdirentries? msdosfs is not the only file system vulnerable to this problem.</div><br><div class="gmail_quote gmail_quote_container"><div dir="ltr" class="gmail_attr">On Thu, Jul 17, 2025 at 3:54 PM Konstantin Belousov <<a href="mailto:kib@freebsd.org">kib@freebsd.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">The branch main has been updated by kib:<br> <br> URL: <a href="https://cgit.FreeBSD.org/src/commit/?id=29af6d2e2ec9fe8df7cf1e1a0bf3597028831b18" rel="noreferrer" target="_blank">https://cgit.FreeBSD.org/src/commit/?id=29af6d2e2ec9fe8df7cf1e1a0bf3597028831b18</a><br> <br> commit 29af6d2e2ec9fe8df7cf1e1a0bf3597028831b18<br> Author: Konstantin Belousov <kib@FreeBSD.org><br> AuthorDate: 2025-07-17 01:12:05 +0000<br> Commit: Konstantin Belousov <kib@FreeBSD.org><br> CommitDate: 2025-07-17 21:53:54 +0000<br> <br> msdosfs: replace '/' in direntries with '?'<br> <br> PR: 288266<br> Reported by: Robert Morris <<a href="mailto:rtm@lcs.mit.edu" target="_blank">rtm@lcs.mit.edu</a>><br> Reviewed by: markj<br> Sponsored by: The FreeBSD Foundation<br> MFC after: 1 week<br> Differential revision: <a href="https://reviews.freebsd.org/D51365" rel="noreferrer" target="_blank">https://reviews.freebsd.org/D51365</a><br> ---<br> sys/fs/msdosfs/msdosfs_conv.c | 11 +++++++++--<br> 1 file changed, 9 insertions(+), 2 deletions(-)<br> <br> diff --git a/sys/fs/msdosfs/msdosfs_conv.c b/sys/fs/msdosfs/msdosfs_conv.c<br> index da4848169173..208b64930e61 100644<br> --- a/sys/fs/msdosfs/msdosfs_conv.c<br> +++ b/sys/fs/msdosfs/msdosfs_conv.c<br> @@ -797,19 +797,24 @@ mbsadjpos(const char **instr, size_t inlen, size_t outlen, int weight, int flag,<br> static u_char *<br> dos2unixchr(u_char *outbuf, const u_char **instr, size_t *ilen, int lower, struct msdosfsmount *pmp)<br> {<br> - u_char c, *outp;<br> - size_t len, olen;<br> + u_char c, *outp, *outp1;<br> + size_t i, len, olen;<br> <br> outp = outbuf;<br> if (pmp->pm_flags & MSDOSFSMNT_KICONV && msdosfs_iconv) {<br> olen = len = 4;<br> <br> + outp1 = outp;<br> if (lower & (LCASE_BASE | LCASE_EXT))<br> msdosfs_iconv->convchr_case(pmp->pm_d2u, (const char **)instr,<br> ilen, (char **)&outp, &olen, KICONV_LOWER);<br> else<br> msdosfs_iconv->convchr(pmp->pm_d2u, (const char **)instr,<br> ilen, (char **)&outp, &olen);<br> + for (i = 0; i < outp - outp1; i++) {<br> + if (outp1[i] == '/')<br> + outp1[i] = '?';<br> + }<br> len -= olen;<br> <br> /*<br> @@ -826,6 +831,8 @@ dos2unixchr(u_char *outbuf, const u_char **instr, size_t *ilen, int lower, struc<br> c = dos2unix[c];<br> if (lower & (LCASE_BASE | LCASE_EXT))<br> c = u2l[c];<br> + if (c == '/')<br> + c = '?';<br> *outp++ = c;<br> outbuf[1] = '\0';<br> }<br> </blockquote></div></div>home | help
Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAOtMX2hdWCAzhieDJkzWZf-5bdw-%2Bycq0m_t0fdrqag11hPW0A>
