]> git.ipfire.org Git - thirdparty/xtables-addons.git/commitdiff
ipp2p: try to address underflows
authorJan Engelhardt <jengelh@medozas.de>
Thu, 8 Oct 2009 15:26:36 +0000 (17:26 +0200)
committerJan Engelhardt <jengelh@medozas.de>
Thu, 8 Oct 2009 15:26:36 +0000 (17:26 +0200)
Report by: Christian Blum <chrblum@users.sourceforge.net>

"I have found that they panic in an interrupt within xt_ipp2p, function
search_all_gnu(). It's a bounds checking problem; when I add this [a
check for plen >= 65535] at the beginning [of the function] the
servers run fine (very similar to find_all_kazaa())."

doc/changelog.txt
extensions/xt_ipp2p.c

index bc16ec9312ad2843d03f6ec38953379c7e95d708..db68ef779397b250979e9bb6742e23fdeba9947d 100644 (file)
@@ -3,6 +3,7 @@ HEAD
 ====
 - build: compile fixes for 2.6.31-rt
 - build: support for Linux 2.6.32
+- ipp2p: try to address underflows
 - psd: avoid potential crash when dealing with non-linear skbs
 - merge xt_ACCOUNT userspace utilities
 
index c0a364d0c3fd0b118ee2a44b3085beb7756a22d1..7223e5063fe857b5b5cc7eefd03631a8ed026afb 100644 (file)
@@ -844,7 +844,13 @@ ipp2p_mt(const struct sk_buff *skb, const struct xt_match_param *par)
                if (tcph->rst) return 0;  /* if RST bit is set bail out */
 
                haystack += tcph->doff * 4; /* get TCP-Header-Size */
-               hlen -= tcph->doff * 4;
+               if (tcph->doff * 4 > hlen) {
+                       if (info->debug)
+                               pr_info("TCP header indicated packet larger than it is\n");
+                       hlen = 0;
+               } else {
+                       hlen -= tcph->doff * 4;
+               }
                while (matchlist[i].command) {
                        if ((info->cmd & matchlist[i].command) == matchlist[i].command &&
                            hlen > matchlist[i].packet_len)