Re: strscpy

Maxime Villard <[email protected]> Fri, 29 May 2020 20:22:34 +0200
Newsgroups gmane.os.netbsd.devel.security
Message-ID <[email protected]>
Le 19/05/2020 à 19:40, Kamil Rytarowski a écrit :
> On 19.05.2020 19:15, Maxime Villard wrote:
>> I would want to keep the difference minimal between the two. I think
>> that the
>> version that returns -1 is nice and addresses the concern. What do you
>> think?
> 
> Personally I have got no strong opinion. I would change "size > INT_MAX"
> to "size > SSIZE_MAX".
> 
> Returning -1 instead of -EINVAL and -E2BIG is good, as there few users
> who check return value at all, and if so, they check whether it is less
> than 0.

I have updated my patch:

	https://m00nbsd.net/garbage/libkern/strscpy.diff

We simply return -1. Will commit soon unless there is valid objection.

Maxime