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

2020-10-22 Thread Francis Laniel
Le jeudi 22 octobre 2020, 01:48:37 CEST Kees Cook a écrit : > On Tue, Oct 20, 2020 at 06:47:06PM +0200, laniel_fran...@privacyrequired.com wrote: > > From: Francis Laniel > > > > nla_strlcpy now returns -E2BIG if src was truncated when written to dst. > > It also returns this error value if dsts

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

2020-10-21 Thread Kees Cook
On Tue, Oct 20, 2020 at 06:47:06PM +0200, laniel_fran...@privacyrequired.com wrote: > From: Francis Laniel > > 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" a

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

2020-10-20 Thread laniel_francis
From: Francis Laniel 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" af