Skip to content

Commit

Permalink
bgpd: fix crash in displaying json orf prefix-list
Browse files Browse the repository at this point in the history
bgpd crashes when there is several entries in the prefix-list. No
backtrace is provided because the issue was catched from a code review.

Fixes: 856ca17 ("Added json formating support to show-...-neighbors-... bgp commands.")
Signed-off-by: Louis Scalbert <[email protected]>
(cherry picked from commit 8ccf609)
  • Loading branch information
louis-6wind authored and mergify[bot] committed Jan 9, 2025
1 parent 0501a48 commit 2de8f29
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/plist.c
Original file line number Diff line number Diff line change
Expand Up @@ -1536,14 +1536,15 @@ int prefix_bgp_show_prefix_list(struct vty *vty, afi_t afi, char *name,
if (use_json) {
json = json_object_new_object();
json_prefix = json_object_new_object();
json_list = json_object_new_object();

json_object_int_add(json_prefix, "prefixListCounter",
plist->count);
json_object_string_add(json_prefix, "prefixListName",
plist->name);

for (pentry = plist->head; pentry; pentry = pentry->next) {
json_list = json_object_new_object();

json_object_int_add(json_list, "seq", pentry->seq);
json_object_string_add(json_list, "seqPrefixListType",
prefix_list_type_str(pentry));
Expand Down

0 comments on commit 2de8f29

Please sign in to comment.