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
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:	Fri, 23 Aug 2013 22:14:39 +0400
From:	Sergei Shtylyov <sergei.shtylyov@...entembedded.com>
To:	Dong Fang <yp.fangdong@...il.com>
CC:	pablo@...filter.org, kaber@...sh.net, kadlec@...ckhole.kfki.hu,
	davem@...emloft.net, netfilter-devel@...r.kernel.org,
	netfilter@...r.kernel.org, coreteam@...filter.org,
	netdev@...r.kernel.org
Subject: Re: [PATCH] netfilter: avoid array overflow in nf_register_hook

Hello.

On 08/24/2013 07:07 AM, Dong Fang wrote:

> This patch fix the array overflow in nf_register_hook function

> Signed-off-by: Dong Fang <yp.fangdong@...il.com>
> ---
>   net/netfilter/core.c |    5 ++++-
>   1 files changed, 4 insertions(+), 1 deletions(-)

> diff --git a/net/netfilter/core.c b/net/netfilter/core.c
> index 2217363..819eee1 100644
> --- a/net/netfilter/core.c
> +++ b/net/netfilter/core.c
> @@ -68,8 +68,11 @@ static DEFINE_MUTEX(nf_hook_mutex);
>   int nf_register_hook(struct nf_hook_ops *reg)
>   {
>   	struct nf_hook_ops *elem;
> -	int err;
> +	int err = -EINVAL;
>
> +	if (reg->pf >= NFPROTO_NUMPROTO || reg->hooknum >= NF_MAX_HOOKS)
> +		return err;

    Why not just return -EINVAL and avoid unneeded 'err' initialization?

> +
>   	err = mutex_lock_interruptible(&nf_hook_mutex);
>   	if (err < 0)
>   		return err;

WBR, Sergei


--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ