aboutsummaryrefslogtreecommitdiffstats
path: root/hicn-plugin/src/hicn_api.c
diff options
context:
space:
mode:
authorAlberto Compagno <acompagn+fdio@cisco.com>2020-01-14 12:02:48 +0100
committerAlberto Compagno <acompagn+fdio@cisco.com>2020-01-15 09:13:11 +0100
commitf2de2bfea184034f675ab4a521e7deaae58c5ff8 (patch)
treecff17c97eba04055f659aa59d0940b6f31cce5f9 /hicn-plugin/src/hicn_api.c
parentdef98b1a2af5292519b18893133e419e940a850b (diff)
[HICN-477] Fixed strategy get ctx that could lead to a segfault
Change-Id: Ic0d4f5a6919cb68255e788ac288d17492a6570a5 Signed-off-by: Alberto Compagno <acompagn+fdio@cisco.com>
Diffstat (limited to 'hicn-plugin/src/hicn_api.c')
-rw-r--r--hicn-plugin/src/hicn_api.c4
1 files changed, 2 insertions, 2 deletions
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]))
{