From: Jo-Philipp Wich Date: Tue, 30 Apr 2013 18:26:44 +0000 (+0200) Subject: Fix parsing of ipset datatypes X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=b17b5bf01abe69806ff287eedb3e6c3f66f0683b;p=oweals%2Ffirewall3.git Fix parsing of ipset datatypes --- 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