summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorManpreet Kaur <manpreetk@nvidia.com>2025-03-13 04:14:24 -0700
committerMergify <37929162+mergify[bot]@users.noreply.github.com>2025-03-15 17:36:44 +0000
commit9c73aab85482260fac9b90d9359ce07d919473e1 (patch)
tree16a3fc80640fbb679472d8b267e657a342b87eed
parent68eaba52efdb8259259a863c050ae0065118036a (diff)
bgpd: Fixed crash upon bgp network import-check command
BT: ``` 3 <signal handler called> 4 0x00005616837546fc in bgp_static_update (bgp=bgp@entry=0x5616865eac50, p=0x561686639e40, bgp_static=0x561686639f50, afi=afi@entry=AFI_IP6, safi=safi@entry=SAFI_UNICAST) at ../bgpd/bgp_route.c:7232 5 0x0000561683754ad0 in bgp_static_add (bgp=0x5616865eac50) at ../bgpd/bgp_table.h:413 6 0x0000561683785e2e in no_bgp_network_import_check (self=<optimized out>, vty=0x5616865e04c0, argc=<optimized out>, argv=<optimized out>) at ../bgpd/bgp_vty.c:4609 7 0x00007fdbcc294820 in cmd_execute_command_real (vline=vline@entry=0x561686663000, ``` The program encountered a SEG FAULT when attempting to access pi->extra->vrfleak->bgp_orig because pi->extra->vrfleak was NULL. ``` (gdb) p pi->extra->vrfleak $1 = (struct bgp_path_info_extra_vrfleak *) 0x0 (gdb) p pi->extra->vrfleak->bgp_orig Cannot access memory at address 0x8 ``` Added NOT NULL check on pi->extra->vrfleak before accessing pi->extra->vrfleak->bgp_orig to prevent the segmentation fault. Signed-off-by: Manpreet Kaur <manpreetk@nvidia.com> (cherry picked from commit bc1008b970541c090e36fc1d50c720df822fcb99)
-rw-r--r--bgpd/bgp_route.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c
index 5f9ae27085..55c22ed052 100644
--- a/bgpd/bgp_route.c
+++ b/bgpd/bgp_route.c
@@ -6836,7 +6836,7 @@ void bgp_static_update(struct bgp *bgp, const struct prefix *p,
&pi->extra->labels->label[0]);
}
#endif
- if (pi->extra && pi->extra->vrfleak->bgp_orig)
+ if (pi->extra && pi->extra->vrfleak && pi->extra->vrfleak->bgp_orig)
bgp_nexthop = pi->extra->vrfleak->bgp_orig;
bgp_nexthop_reachability_check(afi, safi, pi, p, dest,