From cacdff75a6fc9c4fa983408c6035d6763161788a Mon Sep 17 00:00:00 2001 From: Rafael Zalamena Date: Fri, 28 Feb 2025 10:40:35 -0300 Subject: [PATCH] pimd: fix null memory access on IGMP source limit When the IGMP group source limit is reached the function `igmp_get_source_by_addr` won't return a `struct gm_source` so we must test for that condition before attempting to access its fields. Fixes coverity scan issue 1637406. Signed-off-by: Rafael Zalamena --- pimd/pim_igmpv3.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pimd/pim_igmpv3.c b/pimd/pim_igmpv3.c index 2de2b32688..3cbab499db 100644 --- a/pimd/pim_igmpv3.c +++ b/pimd/pim_igmpv3.c @@ -843,7 +843,7 @@ static void toex_incl(struct gm_group *group, int num_sources, /* Lookup reported source (B) */ source = igmp_get_source_by_addr(group, *src_addr, &new); - if (!new) { + if (!new && source != NULL) { /* If found, clear deletion flag: (A*B) */ IGMP_SOURCE_DONT_DELETE(source->source_flags); /* and set SEND flag (A*B) */ -- 2.39.5