diff --git a/bgpd/bgp_table.c b/bgpd/bgp_table.c index 022a6413e2..7e3aa2a48a 100644 --- a/bgpd/bgp_table.c +++ b/bgpd/bgp_table.c @@ -205,8 +205,14 @@ static ssize_t printfrr_bd(char *buf, size_t bsz, const char *fmt, int prec, const void *ptr) { const struct bgp_dest *dest = ptr; - const struct prefix *p = bgp_dest_get_prefix(dest); + const struct prefix *p; + + if (dest) { + p = bgp_dest_get_prefix(dest); + prefix2str(p, buf, bsz); + } else { + strlcpy(buf, "NULL", bsz); + } - prefix2str(p, buf, bsz); return 2; }