From patchwork Sat Jun 29 21:32:22 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mr Dash Four X-Patchwork-Id: 255790 X-Patchwork-Delegate: kadlec@blackhole.kfki.hu Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 1911F2C02B1 for ; Sun, 30 Jun 2013 07:32:34 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752904Ab3F2Vcc (ORCPT ); Sat, 29 Jun 2013 17:32:32 -0400 Received: from mail-we0-f175.google.com ([74.125.82.175]:44308 "EHLO mail-we0-f175.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751731Ab3F2Vcb (ORCPT ); Sat, 29 Jun 2013 17:32:31 -0400 Received: by mail-we0-f175.google.com with SMTP id t59so2187924wes.6 for ; Sat, 29 Jun 2013 14:32:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:cc:subject :content-type:content-transfer-encoding; bh=5OZjNTzmXTxuxBv8cbCcL3V3T2y0RO0JXz2mmYPYzgE=; b=BMJ+18j0vFWSKOP9zarIQ9npeuBUgfxab35No/ZxEdwTvhaf9/7CEPqT5/V/a1k7Dh ZipZOW4sL4DL3Z2uuvE23GX3xb3S07bJg6NnBJDSOITTYS9sP9/l0/hv/xIAeA6PnCdj EW70sFaIBytClyRnL71ANDW4pJbyjJdX7iglAWZACYQPPicNqJpcEuCh4FKawBkcV/gz y1iXbSX7dytZw+3ykWuv3Xixn9ZHTIOXDHyMJXjFyoPtcefj4/4KOd8ev9Bo5RwGMq8k K7+n8DSRpD51UFyrnTdZmHU/g9+aj4aBjnIoxYryoEQHFOZYWV1U53xGZZBXONNqLFSg YMEQ== X-Received: by 10.194.219.198 with SMTP id pq6mr15619299wjc.58.1372541550353; Sat, 29 Jun 2013 14:32:30 -0700 (PDT) Received: from [10.68.68.173] (cpc2-gill1-0-0-cust32.20-1.cable.virginmedia.com. [77.100.109.33]) by mx.google.com with ESMTPSA id fs8sm6476092wib.0.2013.06.29.14.32.28 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sat, 29 Jun 2013 14:32:29 -0700 (PDT) Message-ID: <51CF5266.90100@googlemail.com> Date: Sat, 29 Jun 2013 22:32:22 +0100 From: Dash Four User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.8.1.23) Gecko/20090812 Thunderbird/2.0.0.23 MIME-Version: 1.0 To: Jozsef Kadlecsik CC: Pablo Neira Ayuso , Netfilter Core Team Subject: [PATCH v3 1/5] iptables: bugfix - prevent wrong syntax being accepted by the set match Sender: netfilter-devel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netfilter-devel@vger.kernel.org This patch corrects a bug, which was allowing wrong src and dst syntax to be specified and accepted by the set match. v1 * initial revision Signed-off-by: Dash Four --- extensions/libxt_set.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/extensions/libxt_set.h b/extensions/libxt_set.h index 47c3f5b..a352ac3 100644 --- a/extensions/libxt_set.h +++ b/extensions/libxt_set.h @@ -109,9 +109,9 @@ parse_dirs_v0(const char *opt_arg, struct xt_set_info_v0 *info) while (i < (IPSET_DIM_MAX - 1) && tmp != NULL) { ptr = strsep(&tmp, ","); - if (strncmp(ptr, "src", 3) == 0) + if (strncmp(ptr, "src", 4) == 0) info->u.flags[i++] |= IPSET_SRC; - else if (strncmp(ptr, "dst", 3) == 0) + else if (strncmp(ptr, "dst", 4) == 0) info->u.flags[i++] |= IPSET_DST; else xtables_error(PARAMETER_PROBLEM, @@ -135,9 +135,9 @@ parse_dirs(const char *opt_arg, struct xt_set_info *info) while (info->dim < IPSET_DIM_MAX && tmp != NULL) { info->dim++; ptr = strsep(&tmp, ","); - if (strncmp(ptr, "src", 3) == 0) + if (strncmp(ptr, "src", 4) == 0) info->flags |= (1 << info->dim); - else if (strncmp(ptr, "dst", 3) != 0) + else if (strncmp(ptr, "dst", 4) != 0) xtables_error(PARAMETER_PROBLEM, "You must spefify (the comma separated list of) 'src' or 'dst'."); }