From 88227a80c05cc305711160ba37e6c134654672a4 Mon Sep 17 00:00:00 2001 From: Jo-Philipp Wich Date: Tue, 18 Jun 2013 16:26:11 +0200 Subject: [PATCH] Don't mistreat unknown protocol names as "any protocol" --- options.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/options.c b/options.c index 5a7a901..6f96681 100644 --- a/options.c +++ b/options.c @@ -518,6 +518,7 @@ fw3_parse_protocol(void *ptr, const char *val, bool is_list) { struct fw3_protocol proto = { }; struct protoent *ent; + char *e; if (*val == '!') { @@ -556,9 +557,9 @@ fw3_parse_protocol(void *ptr, const char *val, bool is_list) return true; } - proto.protocol = strtoul(val, NULL, 10); + proto.protocol = strtoul(val, &e, 10); - if (errno == ERANGE || errno == EINVAL) + if ((e == val) || (*e != 0)) return false; put_value(ptr, &proto, sizeof(proto), is_list); -- 2.25.1