diff options
| author | Russ White <russ@riw.us> | 2021-03-02 11:36:49 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-03-02 11:36:49 -0500 |
| commit | 8b528595756bc9f4605e1cc951d6411223e23359 (patch) | |
| tree | 8a0fba3da317c14c9716e131d7063d037e225e51 /lib/srcdest_table.c | |
| parent | e7528866cbe50528efb1a2814ebeb77fe8a9ea68 (diff) | |
| parent | 8e2c653ed30f672617ef97f4479aff24db855154 (diff) | |
Merge pull request #8175 from mjstapp/fix_printfrr_nulls
lib, bgpd: handle NULL inputs in printfrr extensions
Diffstat (limited to 'lib/srcdest_table.c')
| -rw-r--r-- | lib/srcdest_table.c | 9 |
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; } |
