Subject: Re: [RFC][PATCH v3 2/3] Modify return value of nla_strlcpy to match that of strscpy.

From: Kees Cook <[email-masked]>
Date: Wed, 21 Oct 2020 16:48:37 -0700

On Tue, Oct 20, 2020 at 06:47:06PM +0200, [email-masked] wrote:
> From: Francis Laniel <[email-masked]>
> 
> nla_strlcpy now returns -E2BIG if src was truncated when written to dst.
> It also returns this error value if dstsize is 0 or higher than INT_MAX.
> 
> For example, if src is "foo\0" and dst is 3 bytes long, the result will be:
> 1. "foG" after memcpy (G means garbage).
> 2. "fo\0" after memset.
> 3. -E2BIG is returned because src was not completely written into dst.
> 
> The callers of nla_strlcpy were modified to take into account this modification.
> 
> Signed-off-by: Francis Laniel <[email-masked]>

This looks correct to me. Thanks for the respin!

Reviewed-by: Kees Cook <[email-masked]>

-- 
Kees Cook