lists.openwall.net | lists / announce owl-users owl-dev john-users john-dev passwdqc-users yescrypt popa3d-users / oss-security kernel-hardening musl sabotage tlsify passwords / crypt-dev xvendor / Bugtraq Full-Disclosure linux-kernel linux-netdev linux-ext4 linux-hardening linux-cve-announce PHC | |
Open Source and information security mailing list archives
| ||
|
Message-ID: <202010191559.3AC2C3F97@keescook> Date: Mon, 19 Oct 2020 16:01:27 -0700 From: Kees Cook <keescook@...omium.org> To: laniel_francis@...vacyrequired.com Cc: Jakub Kicinski <kuba@...nel.org>, linux-hardening@...r.kernel.org, davem@...emloft.net Subject: Re: [RFC][PATCH v2 2/3] Modify return value of nla_strlcpy to match that of strscpy. On Mon, Oct 19, 2020 at 09:43:55AM -0700, Jakub Kicinski wrote: > On Mon, 19 Oct 2020 17:23:30 +0200 laniel_francis@...vacyrequired.com > wrote: > > -size_t nla_strlcpy(char *dst, const struct nlattr *nla, size_t dstsize) > > +ssize_t nla_strlcpy(char *dst, const struct nlattr *nla, size_t dstsize) > > { > > + size_t len; > > + ssize_t ret; > > size_t srclen = nla_len(nla); > > char *src = nla_data(nla); > > Sort local variables long to short. Specifically, "reverse christmas tree": size_t srclen = nla_len(nla); char *src = nla_data(nla); size_t len; ssize_t ret; > > diff --git a/net/sched/cls_api.c b/net/sched/cls_api.c > > index 41a55c6cbeb8..f0bf64393cbf 100644 > > --- a/net/sched/cls_api.c > > +++ b/net/sched/cls_api.c > > @@ -223,7 +223,7 @@ static inline u32 tcf_auto_prio(struct tcf_proto *tp) > > static bool tcf_proto_check_kind(struct nlattr *kind, char *name) > > { > > if (kind) > > - return nla_strlcpy(name, kind, IFNAMSIZ) >= IFNAMSIZ; > > + return nla_strlcpy(name, kind, IFNAMSIZ) > 0; > > Bug. > > > memset(name, 0, IFNAMSIZ); > > return false; > > } Have you been able to exercise the changed code paths? (I would have expected this to immediately fail, for example.) -- Kees Cook
Powered by blists - more mailing lists