]> git.ipfire.org Git - thirdparty/xtables-addons.git/commitdiff
ipp2p: add boundary check in search_all_kazaa
authorJan Engelhardt <jengelh@medozas.de>
Sat, 10 Jan 2009 05:11:13 +0000 (06:11 +0100)
committerJan Engelhardt <jengelh@medozas.de>
Sat, 10 Jan 2009 05:11:13 +0000 (06:11 +0100)
To avoid underflow on "end - 18", we must check for plen >= 18.

extensions/xt_ipp2p.c

index 16203f9518048eab67b96af795520655b3d416dd..3c5f2388ae95311beb66e6240ad7d3c03964e156 100644 (file)
@@ -623,6 +623,10 @@ search_all_kazaa(const unsigned char *payload, const unsigned int plen)
        if (memcmp(payload, "GET /", 5) != 0)
                return 0;
 
+       if (plen < 18)
+               /* The next tests would not succeed anyhow. */
+               return 0;
+
        end = plen - 18;
        rem = plen - 5;
        for (c = 5; c < end; ++c, --rem) {