summaryrefslogtreecommitdiff
blob: 7f9afb01c78a5febc307acc3d01c6c59f321a9cc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
From b57c64f1aa5c51dd785f2572636b8c41ada06d72 Mon Sep 17 00:00:00 2001
From: Pavel Raiskup <praiskup@redhat.com>
Date: Tue, 30 Aug 2011 15:10:46 +0200
Subject: [PATCH 1/1] network: NULL dereference fix

Variable ifindex dereferenced on line 242 before null check on line 249.
---
 network/common.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/network/common.c b/network/common.c
index 4704072..a223685 100644
--- a/network/common.c
+++ b/network/common.c
@@ -240,13 +240,15 @@ int bnep_if_down(const char *devname)
 
 int bnep_add_to_bridge(const char *devname, const char *bridge)
 {
-	int ifindex = if_nametoindex(devname);
+	int ifindex;
 	struct ifreq ifr;
 	int sk, err;
 
 	if (!devname || !bridge)
 		return -EINVAL;
 
+	ifindex = if_nametoindex(devname);
+
 	sk = socket(AF_INET, SOCK_STREAM, 0);
 	if (sk < 0)
 		return -1;
-- 
1.7.7.6