Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 26 Sep 2021 13:48:28 GMT
From:      Vincenzo Maffione <vmaffione@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: f7cef43aa9a3 - main - nemtap: lb app: Validate ihl field when hashing packet
Message-ID:  <202109261348.18QDmSgX035743@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by vmaffione:

URL: https://cgit.FreeBSD.org/src/commit/?id=f7cef43aa9a357582a703c75dafa4a44c1b2f28c

commit f7cef43aa9a357582a703c75dafa4a44c1b2f28c
Author:     Vincenzo Maffione <vmaffione@FreeBSD.org>
AuthorDate: 2021-09-26 13:44:51 +0000
Commit:     Vincenzo Maffione <vmaffione@FreeBSD.org>
CommitDate: 2021-09-26 13:48:21 +0000

    nemtap: lb app: Validate ihl field when hashing packet
    
    MFC after:      1 week
---
 tools/tools/netmap/pkt_hash.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/tools/tools/netmap/pkt_hash.c b/tools/tools/netmap/pkt_hash.c
index 3071935e11ef..eb9704fd2058 100644
--- a/tools/tools/netmap/pkt_hash.c
+++ b/tools/tools/netmap/pkt_hash.c
@@ -150,7 +150,9 @@ decode_ip_n_hash(const struct ip *iph, uint8_t hash_split, uint8_t seed)
 {
 	uint32_t rc = 0;
 
-	if (hash_split == 2) {
+	if (iph->ip_hl < 5 || iph->ip_hl * 4 > iph->ip_len) {
+		rc = 0;
+	} else if (hash_split == 2) {
 		rc = sym_hash_fn(ntohl(iph->ip_src.s_addr),
 			ntohl(iph->ip_dst.s_addr),
 			ntohs(0xFFFD) + seed,



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202109261348.18QDmSgX035743>