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.
HEAD
====
- ipp2p: add more boundary checks
+- ipp2p: fix Gnutelle line ending detection
Xtables-addons 1.19 (October 12 2009)
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;