X-Git-Url: http://git.archive.openwrt.org/?p=project%2Ffirewall3.git;a=blobdiff_plain;f=options.c;h=6f96681561cbeec9b782da075dab1880a8568400;hp=5a7a901a6433d47b032b9a7e01b0ba3900b2d947;hb=95cc95c7fec2d68fa8e27cc8e8e4b8dbacababf8;hpb=3a3d85b3c787271e4860ca590d716cf557c1fb7e 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);