On Sat, Aug 13, 2022 at 8:42 AM Wolfram Sang <wsa@xxxxxxxxxx> 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