From f2de2bfea184034f675ab4a521e7deaae58c5ff8 Mon Sep 17 00:00:00 2001 From: Alberto Compagno Date: Tue, 14 Jan 2020 12:02:48 +0100 Subject: [HICN-477] Fixed strategy get ctx that could lead to a segfault Change-Id: Ic0d4f5a6919cb68255e788ac288d17492a6570a5 Signed-off-by: Alberto Compagno --- hicn-plugin/src/hicn_api.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'hicn-plugin/src/hicn_api.c') diff --git a/hicn-plugin/src/hicn_api.c b/hicn-plugin/src/hicn_api.c index df3365999..806de2b4e 100644 --- a/hicn-plugin/src/hicn_api.c +++ b/hicn-plugin/src/hicn_api.c @@ -702,7 +702,7 @@ static void vl_api_hicn_api_route_get_t_handler { hicn_dpo_vft = hicn_dpo_get_vft(hicn_dpo_id->dpoi_type); hicn_dpo_ctx = hicn_dpo_vft->hicn_dpo_get_ctx(hicn_dpo_id->dpoi_index); - for (int i = 0; i < hicn_dpo_ctx->entry_count; i++) + for (int i = 0; hicn_dpo_ctx != NULL && i < hicn_dpo_ctx->entry_count; i++) { if (dpo_id_is_valid(&hicn_dpo_ctx->next_hops[i])) { @@ -739,7 +739,7 @@ send_route_details (vl_api_registration_t * reg, { hicn_dpo_vft = hicn_dpo_get_vft (hicn_dpo_id->dpoi_type); hicn_dpo_ctx = hicn_dpo_vft->hicn_dpo_get_ctx (hicn_dpo_id->dpoi_index); - for (int i = 0; i < hicn_dpo_ctx->entry_count; i++) + for (int i = 0; hicn_dpo_ctx != NULL && i < hicn_dpo_ctx->entry_count; i++) { if (dpo_id_is_valid (&hicn_dpo_ctx->next_hops[i])) { -- cgit 1.2.3-korg