public inbox for b.a.t.m.a.n@lists.open-mesh.org
 help / color / mirror / Atom feed
From: Antonio Quartulli <antonio@meshcoding.com>
To: b.a.t.m.a.n@lists.open-mesh.org
Cc: Antonio Quartulli <antonio@meshcoding.com>
Subject: [B.A.T.M.A.N.] [PATCH maint] batman-adv: avoid NULL dereferences and clarify if check
Date: Wed, 17 Sep 2014 09:01:56 +0200	[thread overview]
Message-ID: <1410937316-23199-1-git-send-email-antonio@meshcoding.com> (raw)

Due to a typ0 in an if-condition used in the gateway-client
code it is possible to run in a NULL pointer dereference.

At the same type the same if-condition is not clear.

Fix this by rewriting the if-condition properly.

Introduced by 0853ec7fafe0a195754454832993c6b35e22b842
("batman-adv: tvlv - gateway download/upload bandwidth container")

Signed-off-by: Antonio Quartulli <antonio@meshcoding.com>
Reported-by: David Binderman <dcb314@hotmail.com>
---
 gateway_client.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gateway_client.c b/gateway_client.c
index bcc3e0c..5f09536 100644
--- a/gateway_client.c
+++ b/gateway_client.c
@@ -811,7 +811,7 @@ bool batadv_gw_out_of_range(struct batadv_priv *bat_priv,
 		goto out;
 
 	gw_node = batadv_gw_node_get(bat_priv, orig_dst_node);
-	if (!gw_node->bandwidth_down == 0)
+	if (!gw_node || (gw_node->bandwidth_down == 0))
 		goto out;
 
 	switch (atomic_read(&bat_priv->gw_mode)) {
-- 
1.8.5.5


             reply	other threads:[~2014-09-17  7:01 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-17  7:01 Antonio Quartulli [this message]
2014-09-20 16:17 ` [B.A.T.M.A.N.] [PATCH maint] batman-adv: avoid NULL dereferences and clarify if check Antonio Quartulli

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=1410937316-23199-1-git-send-email-antonio@meshcoding.com \
    --to=antonio@meshcoding.com \
    --cc=b.a.t.m.a.n@lists.open-mesh.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox