diff --git a/src/host.c b/src/host.c
index cecccedd3360e37a7ef5ead87c2bbcd9283124e6..b5d62af80cd7473fcca140cdf39237f665b30efc 100644
--- a/src/host.c
+++ b/src/host.c
@@ -455,6 +455,8 @@ int host_append_dhcpv4_info(char *mac_addr, struct host_node *p)
 					}
 					ret = strncmp(ipaddr, "", 24);
 					if (ret != 0) {
+						if (p->ipv4addr_count >= HOST_MAX_IPV4ADDR)
+							continue;
 						strncpy(p->ipv4addr_list[p->ipv4addr_count], ipaddr, 24);
 						p->ipv4addr_count = (p->ipv4addr_count + 1);
 					}
@@ -469,36 +471,6 @@ int host_append_dhcpv4_info(char *mac_addr, struct host_node *p)
 		return 0;
 }
 
-void host_append_dhcpv6_info(struct host_node *p)
-{
-	FILE *hosts6;
-	char line[512];
-	char hostname[64];
-	char ip6addr[128];
-
-	dbg("Inside %s %d\n", __func__, __LINE__);
-
-	if (!p)
-		return;
-
-	p->ipv6addr_count = 0;
-	hosts6 = fopen("/tmp/hosts/odhcpd", "r");
-	if (hosts6 != NULL) {
-		while (fgets(line, sizeof(line), hosts6) != NULL) {
-			remove_newline(line);
-
-			if (sscanf(line, "%127s %63s", ip6addr, hostname)) {
-				if (strcasecmp(p->hostname, hostname) == 0) {
-					dbg("ipv6 address %s %d\n", __func__, __LINE__);
-					strncpy(p->ipv6addr[p->ipv6addr_count], ip6addr, 128);
-					p->ipv6addr_count = p->ipv6addr_count + 1;
-				}
-			}
-		}
-		fclose(hosts6);
-	}
-}
-
 void mask_num_to_bitmap(int num, uint32_t *map)
 {
 	int i;
@@ -872,9 +844,6 @@ int host_get_ipaddr_hostname(struct topologyd_private *priv,
 		return -1;
 
 	dbg("%s %d ipv4addr = [%s]\n", __func__, __LINE__, p->ipv4addr);
-	// Append DHCPv6 information: IPv6 Address, DUID, Lease Time
-	//if (strlen(p->hostname) > 1)
-		//host_append_dhcpv6_info(p);
 	ret = 0;
 	dbg("Inside %s %d mac=[%s] macinterface =[%d]\n", __func__, __LINE__, macaddr_str, p->intf_type);
 
@@ -1577,6 +1546,17 @@ int host_copy_node_data(struct host_node *src_host,  struct host_node *dest_host
 
 	dbg("Inside %s %d\n", __func__, __LINE__);
 
+	//Check that the ipv4 and ipv6 count
+	if (src_host->ipv4addr_count >= HOST_MAX_IPV4ADDR || dest_host->ipv4addr_count >= HOST_MAX_IPV4ADDR) {
+		err("ipv4 count greater than max \n");
+		return -1;
+	}
+
+	if (src_host->ipv6addr_count >= HOST_MAX_IPV6ADDR || dest_host->ipv6addr_count >= HOST_MAX_IPV6ADDR) {
+		err("ipv6 count greater than max \n");
+		return -1;
+	}
+
 	hwaddr_ntoa(dest_host->hwaddr, mac_str);
 	strncpy(dest_host->device, src_host->device, 16);
 	strncpy(dest_host->network, src_host->network, 16);
@@ -1617,6 +1597,8 @@ int host_copy_node_data(struct host_node *src_host,  struct host_node *dest_host
 				found = 1;
 		}
 		if (found == 0) {
+			if (m >= HOST_MAX_IPV4ADDR)
+				break;
 			strncpy(dest_host->ipv4addr_list[m], src_host->ipv4addr_list[i], 24);
 			m++;
 		}
@@ -1636,6 +1618,8 @@ int host_copy_node_data(struct host_node *src_host,  struct host_node *dest_host
 				found = 1;
 		}
 		if (found == 0) {
+			if (n >= HOST_MAX_IPV6ADDR)
+				break;
 			strncpy(dest_host->ipv6addr[n], src_host->ipv6addr[i], 128);
 			n++;
 		}
diff --git a/src/host.h b/src/host.h
index ccbcc5b0f837e5349dd9a1e91290e520639f2cb7..debf62e413c52acbba6e9a6d53acf15068ab5183 100644
--- a/src/host.h
+++ b/src/host.h
@@ -120,7 +120,6 @@ struct host_node *host_topo_node_del(struct topologyd_private *priv,
 		struct node *node, uint8_t *mac_addr, uint8_t is_wifi);
 int host_get_ipaddr_hostname(struct topologyd_private *priv,
 		char *macaddr_str, struct host_node *p);
-void host_append_dhcpv6_info(struct host_node *p);
 int host_append_dhcpv4_info(char *mac_addr, struct host_node *p);
 int host_add_netlink(int *fd);
 void host_netlink_cb(struct uloop_fd *fd, unsigned int events);
diff --git a/src/ieee1905/topologyd.c b/src/ieee1905/topologyd.c
index eff960d9a1adf2e797746940749dfaf113a09481..bdaac3dec9c03b11ac5f303acdcc99d403d3661e 100644
--- a/src/ieee1905/topologyd.c
+++ b/src/ieee1905/topologyd.c
@@ -228,6 +228,9 @@ int topology_update_devinfo(struct topologyd_private *priv, struct node *n, stru
 	if (!node)
 		return -1;
 
+	if ((node->ipv4addr_count >= HOST_MAX_IPV4ADDR) || (node->ipv6addr_count >= HOST_MAX_IPV6ADDR))
+		return -1;
+
 	n->local_intf_nbr = devinfo->num_interface;
 	dbg("%s %d interface nr = %d\n", __func__, __LINE__, devinfo->num_interface);
 	for (j = 0; j < devinfo->num_interface; j++) {
@@ -251,7 +254,11 @@ int topology_update_devinfo(struct topologyd_private *priv, struct node *n, stru
 		iface_node = host_node_lookup(priv->host.node_htable, tif->macaddr);
 		if (iface_node) {
 			dbg("%s %d we found a node\n", __func__, __LINE__);
-
+			if (((iface_node->ipv4addr_count) >= HOST_MAX_IPV4ADDR) &&
+                                ((iface_node->ipv6addr_count) >= HOST_MAX_IPV6ADDR)) {
+					err("ipv4 or ipv6 count is greater than max \n");
+					return -1;
+			}
 			if (memcmp(node->hwaddr, iface_node->hwaddr, 6)) {
 				int l = 0, m = 0, found1 = 0;
 				int k = 0;
@@ -278,6 +285,8 @@ int topology_update_devinfo(struct topologyd_private *priv, struct node *n, stru
 							found1 = 1;
 					}
 					if (found1 == 0) {
+						if (m >= HOST_MAX_IPV4ADDR)
+							break;
 						strncpy(node->ipv4addr_list[m], iface_node->ipv4addr_list[l], 24);
 						m++;
 					}
@@ -298,6 +307,8 @@ int topology_update_devinfo(struct topologyd_private *priv, struct node *n, stru
 							found1 = 1;
 					}
 					if (found1 == 0) {
+						if (m >= HOST_MAX_IPV6ADDR)
+							break;
 						strncpy(node->ipv6addr[m], iface_node->ipv6addr[l], 128);
 						m++;
 					}