]> git.ipfire.org Git - thirdparty/xtables-addons.git/commitdiff
xt_ipp2p: fix an off-by-one error
authorJeremy Sowden <jeremy@azazel.net>
Mon, 5 Jun 2023 12:17:28 +0000 (21:17 +0900)
committerJan Engelhardt <jengelh@inai.de>
Mon, 5 Jun 2023 20:37:01 +0000 (05:37 +0900)
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

index e311926b2d50dc48146fc143dc3487437aa1e7b0..d11594b871d13e6a5f81f68abaf3a0bc1ae249af 100644 (file)
@@ -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;