diff options
author | Harald Welte <laforge@gnumonks.org> | 2002-02-18 16:15:31 +0000 |
---|---|---|
committer | Harald Welte <laforge@gnumonks.org> | 2002-02-18 16:15:31 +0000 |
commit | 0b0013a73a8f23b315718fff775031f4e6dd721b (patch) | |
tree | d1fbdb5b9c00bf7d687fbb9b364d2f8d8fd77b99 /iptables.c | |
parent | 385a1dd0f3b01fc0fbd6bcdee9796e0240ea77c1 (diff) |
add bugfix in case we are using a protocol number (-p N) which has no matching /etc/protocols entry
Diffstat (limited to 'iptables.c')
-rw-r--r-- | iptables.c | 11 |
1 files changed, 8 insertions, 3 deletions
@@ -689,10 +689,15 @@ find_proto(const char *pname, enum ipt_tryload tryload, int nolookup) { unsigned int proto; - if (string_to_number(pname, 0, 255, &proto) != -1) - return find_match(proto_to_name(proto, nolookup), tryload); + if (string_to_number(pname, 0, 255, &proto) != -1) { + char *protoname = proto_to_name(proto, nolookup); - return find_match(pname, tryload); + if (protoname) + return find_match(protoname, tryload); + } else + return find_match(pname, tryload); + + return NULL; } u_int16_t |