Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1536297

Re: [PATCH] net: ping: check minimum size on ICMP header length

From David Miller <davem@davemloft.net>
Newsgroups linux.kernel
Subject Re: [PATCH] net: ping: check minimum size on ICMP header length
Date 2016-12-05 19:20 +0100
Message-ID <sL61Q-80t-19@gated-at.bofh.it> (permalink)
References <sK6ZX-2TQ-23@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


From: Kees Cook <keescook@chromium.org>
Date: Fri, 2 Dec 2016 16:58:53 -0800

> diff --git a/net/ipv4/ping.c b/net/ipv4/ping.c
> index 205e2000d395..8257be3f032c 100644
> --- a/net/ipv4/ping.c
> +++ b/net/ipv4/ping.c
> @@ -654,7 +654,7 @@ int ping_common_sendmsg(int family, struct msghdr *msg, size_t len,
>  			void *user_icmph, size_t icmph_len) {
>  	u8 type, code;
>  
> -	if (len > 0xFFFF)
> +	if (len > 0xFFFF || len < icmph_len)
>  		return -EMSGSIZE;

As suggested by Lorenzo, please use -EINVAL here.

Thanks.

Back to linux.kernel | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

[PATCH] net: ping: check minimum size on ICMP header length Kees Cook <keescook@chromium.org> - 2016-12-03 02:10 +0100
  Re: [PATCH] net: ping: check minimum size on ICMP header length Lorenzo Colitti <lorenzo@google.com> - 2016-12-05 04:40 +0100
  Re: [PATCH] net: ping: check minimum size on ICMP header length David Miller <davem@davemloft.net> - 2016-12-05 19:20 +0100

csiph-web