| 1 |
From b57c64f1aa5c51dd785f2572636b8c41ada06d72 Mon Sep 17 00:00:00 2001
|
| 2 |
From: Pavel Raiskup <praiskup@redhat.com>
|
| 3 |
Date: Tue, 30 Aug 2011 15:10:46 +0200
|
| 4 |
Subject: [PATCH 1/1] network: NULL dereference fix
|
| 5 |
|
| 6 |
Variable ifindex dereferenced on line 242 before null check on line 249.
|
| 7 |
---
|
| 8 |
network/common.c | 4 +++-
|
| 9 |
1 files changed, 3 insertions(+), 1 deletions(-)
|
| 10 |
|
| 11 |
diff --git a/network/common.c b/network/common.c
|
| 12 |
index 4704072..a223685 100644
|
| 13 |
--- a/network/common.c
|
| 14 |
+++ b/network/common.c
|
| 15 |
@@ -240,13 +240,15 @@ int bnep_if_down(const char *devname)
|
| 16 |
|
| 17 |
int bnep_add_to_bridge(const char *devname, const char *bridge)
|
| 18 |
{
|
| 19 |
- int ifindex = if_nametoindex(devname);
|
| 20 |
+ int ifindex;
|
| 21 |
struct ifreq ifr;
|
| 22 |
int sk, err;
|
| 23 |
|
| 24 |
if (!devname || !bridge)
|
| 25 |
return -EINVAL;
|
| 26 |
|
| 27 |
+ ifindex = if_nametoindex(devname);
|
| 28 |
+
|
| 29 |
sk = socket(AF_INET, SOCK_STREAM, 0);
|
| 30 |
if (sk < 0)
|
| 31 |
return -1;
|
| 32 |
--
|
| 33 |
1.7.7.6
|
| 34 |
|