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] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAHk-=wjGmhaE-Y8GqWKPtWYOi=bOarFgo7UkzHNoOVEKnkXXrQ@mail.gmail.com>
Date:   Sat, 13 Aug 2022 14:37:49 -0700
From:   Linus Torvalds <torvalds@...ux-foundation.org>
To:     Wolfram Sang <wsa@...nel.org>, Julia Lawall <julia.lawall@...ia.fr>
Cc:     linux-i2c@...r.kernel.org, linux-kernel@...r.kernel.org,
        cocci@...teme.lip6.fr
Subject: Re: [PULL REQUEST] i2c-for-5.20-part2

On Sat, Aug 13, 2022 at 8:42 AM Wolfram Sang <wsa@...nel.org> wrote:
>
> * subsystem-wide move from strlcpy to strscpy

Hmm.

Looking around, we still do have a lot of those 'strlcpy()' users, but
99% of them don't use the return value.

And since 'strlcpy()' is complete and utter garbage exactly *BECAUSE*
of the bad return value (it returns the length of the source string -
but an untrusted and possibly unterminated source string is often the
*problem* in the first place), that would make it fairly easy to
convert the rest.

I see two possibilities:

 (a) fix strlcpy() by making it return 'void', and leave all those 99%
of users alone, and convert the (few) cases that actually look at the
return value to strscpy

 (b) auto-convert (with a coccinelle script) all the 'strlcpy()' users
that don't care about the return value, and leave a few broken users
of strlcpy around

I think (b) is the simpler thing, but I have no idea how to write a
coccinelle patch that basically does "if return value of strlcpy is
not used, convert the strlcpy to a strscpy".

I'd love to get rid of strlcpy() entirely, since it's such a horribly
badly designed thing.

                  Linus

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ