From: Mark Stapp Date: Mon, 1 Mar 2021 20:40:51 +0000 (-0500) Subject: bgpd: protect bgp printfrr extension from NULLs X-Git-Tag: base_8.0~329^2~1 X-Git-Url: https://git.puffer.fish/?a=commitdiff_plain;h=001ab42b1916e7ad69b77a7defdfd5e728104688;p=matthieu%2Ffrr.git bgpd: protect bgp printfrr extension from NULLs Protect the bgp printfrr extension from NULL input. Signed-off-by: Mark Stapp --- 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; }