]> git.ipfire.org Git - thirdparty/xtables-addons.git/commitdiff
xt_ipp2p: fix Soulseek false positive matches
authorJeremy Sowden <jeremy@azazel.net>
Mon, 5 Jun 2023 15:10:38 +0000 (00:10 +0900)
committerJan Engelhardt <jengelh@inai.de>
Tue, 6 Jun 2023 11:38:12 +0000 (20:38 +0900)
According to the comment, the last match attempted is:

14 00 00 00 01 yy 00 00 00 STRING(YY) 01 00 00 00 00 46|50 00 00 00 00

However, the conditional that inspects the last ten bytes is followed
by a semicolon, so the printk and return statements are executed
regard- less of what the last ten bytes are.

Remove the semicolon and only execute the printk and return if the
conditional expression is true.

Signed-off-by: Jeremy Sowden <jeremy@azazel.net>
extensions/xt_ipp2p.c

index d11594b871d13e6a5f81f68abaf3a0bc1ae249af..5bdb7eec40d266c4c278e90873d836f171c1bdf0 100644 (file)
@@ -448,13 +448,13 @@ search_soul(const unsigned char *payload, const unsigned int plen)
                        const unsigned char *w = payload + 9 + y;
                        if (get_u32(w, 0) == 0x01 &&
                            (get_u16(w, 4) == 0x4600 ||
-                           get_u16(w, 4) == 0x5000) &&
-                           get_u32(w, 6) == 0x00)
-                               ;
+                            get_u16(w, 4) == 0x5000) &&
+                           get_u32(w, 6) == 0x00) {
 #ifdef IPP2P_DEBUG_SOUL
-                       printk(KERN_DEBUG "Soulssek special client command recognized\n");
+                               printk(KERN_DEBUG "Soulseek special client command recognized\n");
 #endif
-                       return IPP2P_SOUL * 100 + 9;
+                               return IPP2P_SOUL * 100 + 9;
+                       }
                }
        }
        return 0;