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]
Date:   Sat, 24 Jul 2021 14:22:21 +0200
From:   Len Baker <len.baker@....com>
To:     Adam Sampson <ats@...og.org>
Cc:     Len Baker <len.baker@....com>, Kees Cook <keescook@...omium.org>,
        Marcel Holtmann <marcel@...tmann.org>,
        Johan Hedberg <johan.hedberg@...il.com>,
        Luiz Augusto von Dentz <luiz.dentz@...il.com>,
        linux-bluetooth@...r.kernel.org, linux-kernel@...r.kernel.org,
        linux-hardening@...r.kernel.org
Subject: Re: [PATCH] drivers/bluetooth: Remove all strcpy() uses

Hi,

On Sun, Jul 18, 2021 at 05:12:55PM +0100, Adam Sampson wrote:
> Len Baker <len.baker@....com> writes:
>
> > strcpy() performs no bounds checking on the destination buffer. This
> > could result in linear overflows beyond the end of the buffer, leading
> > to all kinds of misbehaviors. The safe replacement is strscpy() but in
> > this case it is better to use the scnprintf to simplify the arithmetic.
> >
> > This is a previous step in the path to remove the strcpy() function
> > entirely from the kernel.
> >
> > Signed-off-by: Len Baker <len.baker@....com>
> > ---
> >  drivers/bluetooth/btmrvl_sdio.c | 27 +++++++++++++--------------
> >  1 file changed, 13 insertions(+), 14 deletions(-)
> >
> > diff --git a/drivers/bluetooth/btmrvl_sdio.c b/drivers/bluetooth/btmrvl_sdio.c
> > index cddd350beba3..d6674b367e05 100644
> > --- a/drivers/bluetooth/btmrvl_sdio.c
> > +++ b/drivers/bluetooth/btmrvl_sdio.c
> > @@ -1350,6 +1350,7 @@ static void btmrvl_sdio_coredump(struct device *dev)
> >  	u8 *dbg_ptr, *end_ptr, *fw_dump_data, *fw_dump_ptr;
> [...]
> > +			size += scnprintf(fw_dump_ptr + size,
> > +					  sizeof(fw_dump_ptr) - size,
> [...]
> > +			size += scnprintf(fw_dump_ptr + size,
> > +					  sizeof(fw_dump_ptr) - size,
>
> sizeof(fw_dump_ptr) there looks wrong -- you want the size of the buffer
> it points to (fw_dump_len + 1)?

Apologies. I will work on it and I will send a new version for review.
Thanks for the feedback.

>
> Thanks,
>
> --
> Adam Sampson <ats@...og.org>                         <http://offog.org/>

Regards,
Len

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ