All of lore.kernel.org
 help / color / mirror / Atom feed
From: Domen Puncer <domen.puncer@samsung.com>
To: netfilter-devel@vger.kernel.org
Subject: [PATCH iptables] libxtables: fix getaddrinfo return value usage
Date: Tue, 10 Jun 2014 14:29:49 +0100	[thread overview]
Message-ID: <5397084D.8020703@samsung.com> (raw)

getaddrinfo return value on error can also be positive.

Signed-off-by: Domen Puncer Kugler <domen.puncer@samsung.com>
---
 libxtables/xtoptions.c |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/libxtables/xtoptions.c b/libxtables/xtoptions.c
index 9b4c5aa..d26d2f8 100644
--- a/libxtables/xtoptions.c
+++ b/libxtables/xtoptions.c
@@ -519,7 +519,7 @@ static void xtopt_parse_host(struct xt_option_call *cb)
 	int ret;

 	ret = getaddrinfo(cb->arg, NULL, &hints, &res);
-	if (ret < 0)
+	if (ret != 0)
 		xt_params->exit_err(PARAMETER_PROBLEM,
 			"getaddrinfo: %s\n", gai_strerror(ret));

@@ -562,7 +562,7 @@ static int xtables_getportbyname(const char *name)
 	int ret;

 	ret = getaddrinfo(NULL, name, NULL, &res);
-	if (ret < 0)
+	if (ret != 0)
 		return -1;
 	ret = -1;
 	for (p = res; p != NULL; p = p->ai_next) {
@@ -675,7 +675,7 @@ static int xtopt_parse_mask(struct xt_option_call *cb)
 	int ret;

 	ret = getaddrinfo(cb->arg, NULL, &hints, &res);
-	if (ret < 0)
+	if (ret != 0)
 		return 0;

 	memcpy(&cb->val.hmask, xtables_sa_host(res->ai_addr, res->ai_family),

             reply	other threads:[~2014-06-10 13:30 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-10 13:29 Domen Puncer [this message]
2014-06-11  9:37 ` [PATCH iptables] libxtables: fix getaddrinfo return value usage Pablo Neira Ayuso
2014-06-11  9:48   ` Domen Puncer
2014-06-11 17:55     ` Pablo Neira Ayuso
2014-06-12  7:01       ` Domen Puncer
2014-06-16  9:48         ` Pablo Neira Ayuso

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5397084D.8020703@samsung.com \
    --to=domen.puncer@samsung.com \
    --cc=netfilter-devel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.