frrouting/staticd
Carmine Scarpitta 68e8eb0bd5 staticd: Fix CID 1668073 (NULL pointer dereference)
```
*** CID 1668073:         Null pointer dereferences  (FORWARD_NULL)
/staticd/static_srv6.c: 812             in static_srv6_neigh_register_if_needed()
806     {
807     	if (!neigh_cache) {
808     		DEBUGD(&static_dbg_srv6, "%s: Initializing neighbor cache", __func__);
809     		static_srv6_neigh_cache_init();
810     	}
811
>>>     CID 1668073:         Null pointer dereferences  (FORWARD_NULL)
>>>     Dereferencing null pointer "neigh_cache".
812     	neigh_cache->resolve_sids_cnt++;
813     	DEBUGD(&static_dbg_srv6, "%s: SRv6 SID resolve count increased to %u", __func__,
814     	       neigh_cache->resolve_sids_cnt);
815
816     	if (!neigh_cache->registered && neigh_cache->resolve_sids_cnt > 0) {
817     		DEBUGD(&static_dbg_srv6, "%s: Registering for IPv6 neighbor notifications",
```

Coverity complains about a potential NULL pointer dereference.
However, neigh_cache is guaranteed to be non-NULL.
This is because if it was initially NULL, static_srv6_neigh_cache_init
would have been called.
static_srv6_neigh_cache_init uses XCALLOC to allocate memory for
neigh_cache, which either succeeds (making neigh_cache non-NULL) or
aborts the program on failure.

Let's add an assert to make Coverity happy.

Signed-off-by: Carmine Scarpitta <cscarpit@cisco.com>
2026-01-08 10:47:52 +00:00
..
.gitignore staticd: Start the addition of a staticd 2018-07-29 12:37:24 -04:00
Makefile staticd: Start the addition of a staticd 2018-07-29 12:37:24 -04:00
static_bfd.c *: only include frr json.h where needed 2025-12-11 13:20:01 -05:00
static_debug.c staticd: Add debug option for SRv6 2025-01-18 10:28:49 +00:00
static_debug.h staticd: Add debug option for SRv6 2025-01-18 10:28:49 +00:00
static_main.c mgmtd: remove client specific data from mgmtd 2025-12-23 09:53:45 +00:00
static_nb.c staticd: Add nb callbacks for SRv6 encap behavior 2025-04-30 16:54:43 +00:00
static_nb.h staticd: Add nb callbacks for SRv6 encap behavior 2025-04-30 16:54:43 +00:00
static_nb_config.c staticd: Only set flag when the SID is actually sent to zebra 2025-12-17 00:36:14 +00:00
static_nht.c staticd: fix NHT for dst-src routes 2025-01-28 15:40:17 +01:00
static_nht.h staticd: fix NHT for dst-src routes 2025-01-28 15:40:17 +01:00
static_routes.c staticd: Remove unnecessary function parameters 2025-06-25 18:56:08 +08:00
static_routes.h staticd: Extend CLI to support encap behavior 2025-04-30 16:54:43 +00:00
static_srv6.c staticd: Fix CID 1668073 (NULL pointer dereference) 2026-01-08 10:47:52 +00:00
static_srv6.h staticd: Cleanup all associated neighbors on interface down 2025-12-17 00:36:11 +00:00
static_vrf.c staticd: fix botched staticd YANG for dst-src 2025-01-28 15:40:17 +01:00
static_vrf.h staticd: fix NB dependency hack 2024-02-02 00:57:59 +02:00
static_vty.c staticd: Prevent deleting a static route if blackhole type is not the same 2025-12-18 16:47:57 +02:00
static_vty.h mgmtd, staticd: output staticd configuration from mgmtd 2023-11-21 13:28:40 +02:00
static_zebra.c staticd: Only set flag when the SID is actually sent to zebra 2025-12-17 00:36:14 +00:00
static_zebra.h staticd: Send neighbor discovery messages to verify stale neighbors 2025-12-17 00:36:11 +00:00
subdir.am staticd: Add infrastructure for SRv6 2025-01-18 10:28:49 +00:00