On Mon, Aug 15, 2016 at 12:51:02PM +0200, Carlos Falgueras García wrote:
> Checks array limits before access it and adds a missed translation.
> 
> Signed-off-by: Carlos Falgueras García <carlo...@riseup.net>
> ---
>  src/utils.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/src/utils.c b/src/utils.c
> index e2715a2..7264d1f 100644
> --- a/src/utils.c
> +++ b/src/utils.c
> @@ -23,6 +23,7 @@
>  #include <linux/netfilter/nf_tables.h>
>  
>  static const char *const nftnl_family_str[NFPROTO_NUMPROTO] = {
> +     [NFPROTO_UNSPEC]        = "unknown",

You don't need this line above, right? I can mangle the patch here
before applying it.

>       [NFPROTO_INET]          = "inet",
>       [NFPROTO_IPV4]          = "ip",
>       [NFPROTO_ARP]           = "arp",
> @@ -33,7 +34,7 @@ static const char *const nftnl_family_str[NFPROTO_NUMPROTO] 
> = {
>  
>  const char *nftnl_family2str(uint32_t family)
>  {
> -     if (nftnl_family_str[family] == NULL)
> +     if (family >= NFPROTO_NUMPROTO || !nftnl_family_str[family])
>               return "unknown";
>  
>       return nftnl_family_str[family];
> -- 
> 2.8.3
> 
--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to