From b17b5bf01abe69806ff287eedb3e6c3f66f0683b Mon Sep 17 00:00:00 2001 From: Jo-Philipp Wich Date: Tue, 30 Apr 2013 20:26:44 +0200 Subject: [PATCH] Fix parsing of ipset datatypes --- options.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/options.c b/options.c index 8315aaf..724a215 100644 --- a/options.c +++ b/options.c @@ -565,26 +565,32 @@ fw3_parse_ipset_method(void *ptr, const char *val, bool is_list) bool fw3_parse_ipset_datatype(void *ptr, const char *val, bool is_list) { - struct fw3_ipset_datatype *type = ptr; + struct fw3_ipset_datatype type = { }; if (!strncmp(val, "dest_", 5)) { val += 5; - type->dest = true; + type.dest = true; } else if (!strncmp(val, "dst_", 4)) { val += 4; - type->dest = true; + type.dest = true; } else if (!strncmp(val, "src_", 4)) { val += 4; - type->dest = false; + type.dest = false; } - return parse_enum(&type->type, val, ipset_types, - FW3_IPSET_TYPE_IP, FW3_IPSET_TYPE_SET); + if (parse_enum(&type.type, val, ipset_types, + FW3_IPSET_TYPE_IP, FW3_IPSET_TYPE_SET)) + { + put_value(ptr, &type, sizeof(type), is_list); + return true; + } + + return false; } bool -- 2.25.1