]> git.ipfire.org Git - thirdparty/iptables.git/commitdiff
xtoptions: respect return value in xtables_getportbyname
authorJan Engelhardt <jengelh@medozas.de>
Thu, 14 Apr 2011 11:54:24 +0000 (13:54 +0200)
committerJan Engelhardt <jengelh@medozas.de>
Thu, 14 Apr 2011 11:54:54 +0000 (13:54 +0200)
If ret was negative, ntohs may make it positive, which is undesired.

Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
xtoptions.c

index c3cc40e66c5c2579fe68da8141ff0b4b71b51695..8478d26de4e66e66f3178fbc3a282928d62a1b1e 100644 (file)
@@ -379,6 +379,8 @@ static int xtables_getportbyname(const char *name)
                }
        }
        freeaddrinfo(res);
+       if (ret < 0)
+               return ret;
        return ntohs(ret);
 }