From mboxrd@z Thu Jan 1 00:00:00 1970 From: Dash Four Subject: [PATCH v2 1/5] iptables: bugfix: prevent wrong syntax being accepted by the set match Date: Mon, 17 Jun 2013 00:27:05 +0100 Message-ID: <51BE49C9.2070007@googlemail.com> References: Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: Pablo Neira Ayuso , Netfilter Core Team To: Jozsef Kadlecsik Return-path: Received: from mail-wi0-f177.google.com ([209.85.212.177]:58564 "EHLO mail-wi0-f177.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755408Ab3FPX1Q (ORCPT ); Sun, 16 Jun 2013 19:27:16 -0400 Received: by mail-wi0-f177.google.com with SMTP id ey16so1665722wid.10 for ; Sun, 16 Jun 2013 16:27:15 -0700 (PDT) In-Reply-To: Sender: netfilter-devel-owner@vger.kernel.org List-ID: This patch corrects a bug, which was allowing wrong src and dst syntax to be specified and accepted by the set match. Signed-off-by: Dash Four --- extensions/libxt_set.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) 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'."); }