From 3f7288abfe279c2ca5bc79bbbfcd981d7eb1b9e8 Mon Sep 17 00:00:00 2001 From: Chris Blum Date: Thu, 15 Oct 2009 16:27:06 +0200 Subject: [PATCH] ipp2p: fix Gnutella line ending detection There is another mistake in the code. I have checked the Gnutella protocol specification -- looks like the line separation is 0x0d-0x0a and not 0x0a-0x0d (it seemed obvious but I was not sure and thought they cannot have possibly got that wrong...). It would certainly explain why I have never seen a match on any of my systems. --- doc/changelog.txt | 1 + extensions/xt_ipp2p.c | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/doc/changelog.txt b/doc/changelog.txt index 113bd60..beb1f41 100644 --- a/doc/changelog.txt +++ b/doc/changelog.txt @@ -2,6 +2,7 @@ HEAD ==== - ipp2p: add more boundary checks +- ipp2p: fix Gnutelle line ending detection Xtables-addons 1.19 (October 12 2009) diff --git a/extensions/xt_ipp2p.c b/extensions/xt_ipp2p.c index 0f5c55f..32d91c9 100644 --- a/extensions/xt_ipp2p.c +++ b/extensions/xt_ipp2p.c @@ -586,8 +586,8 @@ search_all_gnu(const unsigned char *payload, const unsigned int plen) unsigned int c; for (c = 0; c < plen - 22; ++c) - if (payload[c] == 0x0a && - payload[c+1] == 0x0d && + if (payload[c] == 0x0d && + payload[c+1] == 0x0a && (memcmp(&payload[c+2], "X-Gnutella-", 11) == 0 || memcmp(&payload[c+2], "X-Queue:", 8) == 0)) return IPP2P_GNU * 100 + 3;