lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAH2r5msKF-YZsmWEwqZZEn2ibooEOtFm7khvSnhD9uOidNycew@mail.gmail.com>
Date:   Fri, 20 Aug 2021 00:58:50 -0500
From:   Steve French <smfrench@...il.com>
To:     Jeff Layton <jlayton@...nel.org>
Cc:     Len Baker <len.baker@....com>, Steve French <sfrench@...ba.org>,
        Suresh Jayaraman <sjayaraman@...e.de>,
        CIFS <linux-cifs@...r.kernel.org>,
        samba-technical <samba-technical@...ts.samba.org>,
        LKML <linux-kernel@...r.kernel.org>,
        Kees Cook <keescook@...omium.org>,
        linux-hardening@...r.kernel.org
Subject: Re: [PATCH] CIFS: Fix a potencially linear read overflow

Added RB and repushed to cifs-2.6.git for-next

On Wed, Aug 18, 2021 at 8:22 AM Jeff Layton <jlayton@...nel.org> wrote:
>
> On Tue, 2021-08-17 at 12:27 +0200, Len Baker wrote:
> > strlcpy() reads the entire source buffer first. This read may exceed the
> > destination size limit. This is both inefficient and can lead to linear
> > read overflows if a source string is not NUL-terminated.
> >
> > Also, the strnlen() call does not avoid the read overflow in the strlcpy
> > function when a not NUL-terminated string is passed.
> >
> > So, replace this block by a call to kstrndup() that avoids this type of
> > overflow and does the same.
> >
> > Fixes: 066ce6899484d ("cifs: rename cifs_strlcpy_to_host and make it use new functions")
> > Signed-off-by: Len Baker <len.baker@....com>
> > ---
> >  fs/cifs/cifs_unicode.c | 9 ++-------
> >  1 file changed, 2 insertions(+), 7 deletions(-)
> >
> > diff --git a/fs/cifs/cifs_unicode.c b/fs/cifs/cifs_unicode.c
> > index 9bd03a231032..171ad8b42107 100644
> > --- a/fs/cifs/cifs_unicode.c
> > +++ b/fs/cifs/cifs_unicode.c
> > @@ -358,14 +358,9 @@ cifs_strndup_from_utf16(const char *src, const int maxlen,
> >               if (!dst)
> >                       return NULL;
> >               cifs_from_utf16(dst, (__le16 *) src, len, maxlen, codepage,
> > -                            NO_MAP_UNI_RSVD);
> > +                             NO_MAP_UNI_RSVD);
> >       } else {
> > -             len = strnlen(src, maxlen);
> > -             len++;
> > -             dst = kmalloc(len, GFP_KERNEL);
> > -             if (!dst)
> > -                     return NULL;
> > -             strlcpy(dst, src, len);
> > +             dst = kstrndup(src, maxlen, GFP_KERNEL);
> >       }
> >
> >       return dst;
> > --
> > 2.25.1
> >
>
> Reviewed-by: Jeff Layton <jlayton@...nel.org>
>


-- 
Thanks,

Steve

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ