summaryrefslogtreecommitdiff
path: root/lib/srcdest_table.c
diff options
context:
space:
mode:
authorMark Stapp <mjs@voltanet.io>2021-03-01 15:41:30 -0500
committerMark Stapp <mjs@voltanet.io>2021-03-01 15:41:30 -0500
commit8e2c653ed30f672617ef97f4479aff24db855154 (patch)
treef53a4d41bb799360edbd2bcd757146abd9ce35c4 /lib/srcdest_table.c
parent001ab42b1916e7ad69b77a7defdfd5e728104688 (diff)
lib: protect printfrr extensions from NULL input
Protect the lib printfrr extension handlers from NULL inputs. Signed-off-by: Mark Stapp <mjs@voltanet.io>
Diffstat (limited to 'lib/srcdest_table.c')
-rw-r--r--lib/srcdest_table.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/lib/srcdest_table.c b/lib/srcdest_table.c
index 8ffa0e9709..ef82b7ac01 100644
--- a/lib/srcdest_table.c
+++ b/lib/srcdest_table.c
@@ -313,8 +313,13 @@ static ssize_t printfrr_rn(char *buf, size_t bsz, const char *fmt,
const struct route_node *rn = ptr;
const struct prefix *dst_p, *src_p;
- srcdest_rnode_prefixes(rn, &dst_p, &src_p);
- srcdest2str(dst_p, (const struct prefix_ipv6 *)src_p, buf, bsz);
+ if (rn) {
+ srcdest_rnode_prefixes(rn, &dst_p, &src_p);
+ srcdest2str(dst_p, (const struct prefix_ipv6 *)src_p, buf, bsz);
+ } else {
+ strlcpy(buf, "NULL", bsz);
+ }
+
return 2;
}