From 3300c18821cb8fb8045c49c48a5c2386aea9a537 Mon Sep 17 00:00:00 2001 From: Daniel Wagner Date: Thu, 17 Mar 2011 14:25:37 +0100 Subject: [PATCH] vpn: Fix possible null pointer dereference Reported by: DJ Cozatt --- plugins/vpn.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/plugins/vpn.c b/plugins/vpn.c index 4685b51..b75df05 100644 --- a/plugins/vpn.c +++ b/plugins/vpn.c @@ -106,14 +106,16 @@ void vpn_died(struct connman_task *task, int exit_code, void *user_data) { struct connman_provider *provider = user_data; struct vpn_data *data = connman_provider_get_data(provider); - int state = data->state; + int state = VPN_STATE_FAILURE; enum connman_provider_error ret; DBG("provider %p data %p", provider, data); - if (!data) + if (data == NULL) goto vpn_exit; + state = data->state; + kill_tun(data->if_name); connman_provider_set_data(provider, NULL); connman_rtnl_remove_watch(data->watch); -- 2.7.4