Messages in this thread | | | Date | Tue, 28 Apr 2015 13:51:42 -0700 | Subject | Re: revert "fs/befs/linuxvfs.c: replace strncpy by strlcpy" | From | Linus Torvalds <> |
| |
On Tue, Apr 28, 2015 at 12:48 PM, Chris Metcalf <cmetcalf@ezchip.com> wrote: > > FWIW, I wanted to deal with some strncpy/strlcpy API issues last year > and just put a "strscpy()" function in arch/tile/gxio/mpipe.c,
So quite frankly, I don't like that one either.
Some people really *do* want truncation, and your strscpy() makes that impossible.
Also, your strscpy() implementation is actually not thread-safe: it can return an non-terminated string if the source string isn't stable. That can certainly be a design issue ("don't do that then"), but it *can* be a possible source of security issues, so it's a bad idea in something that is supposed to be secure.
And quite frankly, I think that the *only* valid reason to add another random string copy function is that you actually get it right. We don't need yet another half-arsed routine that can be easily misused. We have too many of those.
Linus
| |