projects
/
framework
/
connectivity
/
connman.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
ad0a13c
)
connection: Fix possible NULL dereference
author
Adrien Bustany
<adrien.bustany@nokia.com>
Tue, 8 May 2012 14:26:07 +0000
(17:26 +0300)
committer
Marcel Holtmann
<marcel@holtmann.org>
Tue, 8 May 2012 14:49:15 +0000
(07:49 -0700)
src/connection.c
patch
|
blob
|
history
diff --git
a/src/connection.c
b/src/connection.c
index
712a4be
..
f86f0ec
100644
(file)
--- a/
src/connection.c
+++ b/
src/connection.c
@@
-845,28
+845,32
@@
int __connman_connection_gateway_add(struct connman_service *service,
* the VPN. The route might already exist depending
* on network topology.
*/
* the VPN. The route might already exist depending
* on network topology.
*/
- if (g_strcmp0(active_gateway->ipv4_gateway->gateway, "0.0.0.0") != 0)
- dest = active_gateway->ipv4_gateway->gateway;
- else
- dest = NULL;
-
- connman_inet_add_host_route(active_gateway->index,
- gateway,
- dest);
+ if (active_gateway != NULL) {
+ if (g_strcmp0(active_gateway->ipv4_gateway->gateway, "0.0.0.0") != 0)
+ dest = active_gateway->ipv4_gateway->gateway;
+ else
+ dest = NULL;
+
+ connman_inet_add_host_route(active_gateway->index,
+ gateway,
+ dest);
+ }
} else if (type == CONNMAN_IPCONFIG_TYPE_IPV6) {
if (new_gateway->ipv6_gateway != NULL)
set_vpn_routes(new_gateway->ipv6_gateway,
service, gateway, type, peer);
} else if (type == CONNMAN_IPCONFIG_TYPE_IPV6) {
if (new_gateway->ipv6_gateway != NULL)
set_vpn_routes(new_gateway->ipv6_gateway,
service, gateway, type, peer);
- if (g_strcmp0(active_gateway->ipv6_gateway->gateway, "::") != 0)
- dest = active_gateway->ipv6_gateway->gateway;
- else
- dest = NULL;
+ if (active_gateway != NULL) {
+ if (g_strcmp0(active_gateway->ipv6_gateway->gateway, "::") != 0)
+ dest = active_gateway->ipv6_gateway->gateway;
+ else
+ dest = NULL;
- connman_inet_add_ipv6_host_route(active_gateway->index,
- gateway,
- dest);
+ connman_inet_add_ipv6_host_route(active_gateway->index,
+ gateway,
+ dest);
+ }
}
} else {
}
} else {