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

2020-11-13 Thread Francis Laniel
Le vendredi 30 octobre 2020, 20:25:38 CET Kees Cook a écrit : > On Fri, Oct 30, 2020 at 04:36:46PM +0100, laniel_fran...@privacyrequired.com wrote: > > diff --git a/net/sched/sch_api.c b/net/sched/sch_api.c > > index 2a76a2f5ed88..f9b053b30a7b 100644 > > --- a/net/sched/sch_api.c > > +++ b/net/sch

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

2020-10-30 Thread Kees Cook
On Fri, Oct 30, 2020 at 04:36:46PM +0100, laniel_fran...@privacyrequired.com wrote: > diff --git a/net/sched/sch_api.c b/net/sched/sch_api.c > index 2a76a2f5ed88..f9b053b30a7b 100644 > --- a/net/sched/sch_api.c > +++ b/net/sched/sch_api.c > @@ -1170,7 +1170,7 @@ static struct Qdisc *qdisc_create(s

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

2020-10-30 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