From patchwork Mon Jun 5 19:17:29 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeremy Sowden X-Patchwork-Id: 1790623 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=2620:137:e000::1:20; helo=out1.vger.email; envelope-from=netfilter-devel-owner@vger.kernel.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; secure) header.d=azazel.net header.i=@azazel.net header.a=rsa-sha256 header.s=20220717 header.b=GL+z/mIt; dkim-atps=neutral Received: from out1.vger.email (out1.vger.email [IPv6:2620:137:e000::1:20]) by legolas.ozlabs.org (Postfix) with ESMTP id 4QZk3N393sz20Vv for ; Tue, 6 Jun 2023 05:20:48 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231544AbjFETUq (ORCPT ); Mon, 5 Jun 2023 15:20:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41752 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235539AbjFETTv (ORCPT ); Mon, 5 Jun 2023 15:19:51 -0400 Received: from taras.nevrast.org (unknown [IPv6:2a05:d01c:431:aa03:b7e1:333d:ea2a:b14e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1D5331702 for ; Mon, 5 Jun 2023 12:19:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=azazel.net; s=20220717; h=Content-Transfer-Encoding:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Sender:Reply-To:Cc:Content-Type:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=nYuY1ihBvSji0HCIpSK5PJx4FHWv/wqhbesM3GboJGE=; b=GL+z/mItEEUSjxt8Fu78gQ5N3l RrHtVHOxCYkCWAAg2OEd1hgqXxmnZb66tyTG2mkRJLPlVIpeNxQsuDif0Iz4bU++4O32JaoEWxIX/ c4Afb5G0sro+gMQrlh2QYOZS6UkE4xQ9sbtzllW1DNp4shp92iwx7L0YSEKQHD4j54fT6qonjZeG2 l29i+ZZ5cCMZw9YoqX71up9ML1mJ71Or43Jt3dc5dsiUz5o7L3w60IZgMS4/FDvxUsxUOzBSsH6LO oY9k58k1KUdLkNLXSNFEnEclyZTIypr/KUgQmR/OlMaFq51EoKbMQRMMOiswogdk4h7fCOq2GP12f HNDgxZKw==; Received: from [2001:8b0:135f:bcd1:e0cb:4eff:fedf:e608] (helo=ulthar.dreamlands) by taras.nevrast.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1q6FjL-00H0rc-48 for netfilter-devel@vger.kernel.org; Mon, 05 Jun 2023 20:19:03 +0100 From: Jeremy Sowden To: Netfilter Devel Subject: [PATCH xtables-addons 2/8] xt_ipp2p: fix Soulseek false-positive matches Date: Mon, 5 Jun 2023 20:17:29 +0100 Message-Id: <20230605191735.119210-3-jeremy@azazel.net> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230605191735.119210-1-jeremy@azazel.net> References: <20230605191735.119210-1-jeremy@azazel.net> MIME-Version: 1.0 X-SA-Exim-Connect-IP: 2001:8b0:135f:bcd1:e0cb:4eff:fedf:e608 X-SA-Exim-Mail-From: jeremy@azazel.net X-SA-Exim-Scanned: No (on taras.nevrast.org); SAEximRunCond expanded to false X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RDNS_NONE,SPF_HELO_FAIL, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: netfilter-devel@vger.kernel.org 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 semi-colon, so the printk and return statements are executed regard- less of what the last ten bytes are. Remove the semi-colon and only execute the printk and return if the conditional expression is true. Signed-off-by: Jeremy Sowden --- extensions/xt_ipp2p.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/extensions/xt_ipp2p.c b/extensions/xt_ipp2p.c index a90d1b3d57c8..5f7d5f61b96e 100644 --- a/extensions/xt_ipp2p.c +++ b/extensions/xt_ipp2p.c @@ -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;