[PATCH 4/8] Null dereference fix

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 6da9f0a..f8cd721 100644
--- a/network/common.c
+++ b/network/common.c
@@ -239,13 +239,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.4.4
--
To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux