NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

kern/56840: use ntohl(ntohs(cpi)) when 0-extending ipcomp CPI



>Number:         56840
>Category:       kern
>Synopsis:       use ntohl(ntohs(cpi)) when 0-extending ipcomp CPI
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    kern-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon May 16 18:20:00 +0000 2022
>Originator:     Andrew Cagney
>Release:        trunk
>Organization:
>Environment:
trunk
>Description:
use ntohl(ntohs(cpi)) when 0-extending ipcomp CPI

---
 sys/netipsec/ipsec_input.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys/netipsec/ipsec_input.c b/sys/netipsec/ipsec_input.c
index a5ce54aec96f..7551ca79e3a7 100644
--- a/sys/netipsec/ipsec_input.c
+++ b/sys/netipsec/ipsec_input.c
@@ -229,7 +229,7 @@ ipsec_common_input(struct mbuf *m, int skip, int protoff, int af, int sproto)
 	} else if (sproto == IPPROTO_IPCOMP) {
 		u_int16_t cpi;
 		m_copydata(m, skip + sizeof(u_int16_t), sizeof(u_int16_t), &cpi);
-		spi = ntohl(htons(cpi));
+		spi = htonl(ntohs(cpi));	/* 0 extend */
 	} else {
 		panic("%s called with bad protocol number: %d\n", __func__,
 		    sproto);
-- 
2.35.3

>How-To-Repeat:

>Fix:



Home | Main Index | Thread Index | Old Index