diff mbox series

[xtables-addons,1/8] xt_ipp2p: fix an off-by-one error

Message ID 20230605191735.119210-2-jeremy@azazel.net
State Not Applicable, archived
Headers show
Series xt_ipp2p: support for non-linear packets | expand

Commit Message

Jeremy Sowden June 5, 2023, 7:17 p.m. UTC
When checking for waste, we check that the packet is at least eight
bytes long and then examine the first nine bytes.  Fix the length check.

Signed-off-by: Jeremy Sowden <jeremy@azazel.net>
---
 extensions/xt_ipp2p.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/extensions/xt_ipp2p.c b/extensions/xt_ipp2p.c
index 2a9f3e4553b0..a90d1b3d57c8 100644
--- a/extensions/xt_ipp2p.c
+++ b/extensions/xt_ipp2p.c
@@ -793,7 +793,7 @@  search_xdcc(const unsigned char *payload, const unsigned int plen)
 static unsigned int
 search_waste(const unsigned char *payload, const unsigned int plen)
 {
-	if (plen >= 8 && memcmp(payload, "GET.sha1:", 9) == 0)
+	if (plen >= 9 && memcmp(payload, "GET.sha1:", 9) == 0)
 		return IPP2P_WASTE * 100 + 0;
 
 	return 0;