From: Louis Scalbert Date: Tue, 23 Jan 2024 08:29:26 +0000 (+0100) Subject: bgpd: fix deference before check in rpki_create_socket X-Git-Tag: base_10.0~92^2~3 X-Git-Url: https://git.puffer.fish/?a=commitdiff_plain;h=39c8c97d41616c6fb0abf92c48c24b8efd2a7ffe;p=matthieu%2Ffrr.git bgpd: fix deference before check in rpki_create_socket Fix deference before check coverity scanner issue 1575918 in rpki_create_socket() Fixes: a951752d4a ("bgpd: create cache server socket in vrf") Signed-off-by: Louis Scalbert --- diff --git a/bgpd/bgp_rpki.c b/bgpd/bgp_rpki.c index 332f3c8def..de5476173d 100644 --- a/bgpd/bgp_rpki.c +++ b/bgpd/bgp_rpki.c @@ -1276,7 +1276,7 @@ static int rpki_create_socket(void *_cache) { struct timeval prev_snd_tmout, prev_rcv_tmout, timeout; struct cache *cache = (struct cache *)_cache; - struct rpki_vrf *rpki_vrf = cache->rpki_vrf; + struct rpki_vrf *rpki_vrf; struct tr_tcp_config *tcp_config; struct addrinfo *res = NULL; struct addrinfo hints = {}; @@ -1294,6 +1294,8 @@ static int rpki_create_socket(void *_cache) if (!cache) return -1; + rpki_vrf = cache->rpki_vrf; + if (rpki_vrf->vrfname == NULL) vrf = vrf_lookup_by_id(VRF_DEFAULT); else