From b7c33195092db8991b0213a834d942427e81a0e3 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Wed, 9 May 2012 13:48:24 +0300 Subject: [PATCH] dhcp: Check NULL pointer dereference --- src/dhcp.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/dhcp.c b/src/dhcp.c index b267074..22eca60 100644 --- a/src/dhcp.c +++ b/src/dhcp.c @@ -294,7 +294,8 @@ static void lease_available_cb(GDHCPClient *dhcp_client, gpointer user_data) dhcp->nameservers = nameservers; - for (i = 0; dhcp->nameservers[i] != NULL; i++) { + for (i = 0; dhcp->nameservers != NULL && + dhcp->nameservers[i] != NULL; i++) { __connman_service_nameserver_append(service, dhcp->nameservers[i], FALSE); } @@ -313,7 +314,8 @@ static void lease_available_cb(GDHCPClient *dhcp_client, gpointer user_data) dhcp->timeservers = timeservers; - for (i = 0; dhcp->timeservers[i] != NULL; i++) { + for (i = 0; dhcp->timeservers != NULL && + dhcp->timeservers[i] != NULL; i++) { __connman_service_timeserver_append(service, dhcp->timeservers[i]); } -- 2.7.4