From mboxrd@z Thu Jan 1 00:00:00 1970 From: Pablo Neira Ayuso Subject: Re: [PATCH net] netfilter: xt_hashlimit: do not allow empty names Date: Fri, 2 Feb 2018 13:17:23 +0100 Message-ID: <20180202121723.47wr5qosugbdse76@salvia> References: <1517154099.3715.77.camel@gmail.com> <1517162045.3715.78.camel@gmail.com> <20180202114938.jxsaun6w3hnfedfz@salvia> <20180202115522.bmuukhfib4harcoy@salvia> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: Eric Dumazet , Jozsef Kadlecsik , Florian Westphal , netfilter-devel@vger.kernel.org, netdev To: Jan Engelhardt Return-path: Content-Disposition: inline In-Reply-To: Sender: netfilter-devel-owner@vger.kernel.org List-Id: netdev.vger.kernel.org On Fri, Feb 02, 2018 at 01:12:08PM +0100, Jan Engelhardt wrote: > On Friday 2018-02-02 12:55, Pablo Neira Ayuso wrote: > > >On Fri, Feb 02, 2018 at 12:49:38PM +0100, Pablo Neira Ayuso wrote: > >[...] > >> bool net_valid_name(const char *name, size_t len) > >> { > >> ... > >> } > > > >Am I missing anything in all these tricky string handling? Thanks! > > One will have to watch out for calls like > > net_valid_name(NLA_DATA(some_ifla_name), IFNAMSIZ) > > because quite some nlattrs (IFLA_NAME, IFLA_IFNAME to boot) are NLA_STRINGs > (rather than NLA_NUL_STRINGs) and they are not \0-terminated. As long as we use nla_str*() helpers, we're all good.