From: Louis Scalbert Date: Thu, 9 Jan 2025 17:28:53 +0000 (+0100) Subject: bgpd: fix crash in displaying json orf prefix-list X-Git-Tag: docker/10.1.3~36^2 X-Git-Url: https://git.puffer.fish/?a=commitdiff_plain;h=d4343e3ca9925904bc6fe4afcaaa57ac6d737297;p=matthieu%2Ffrr.git bgpd: fix crash in displaying json orf prefix-list 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: 856ca177c4 ("Added json formating support to show-...-neighbors-... bgp commands.") Signed-off-by: Louis Scalbert (cherry picked from commit 8ccf60921b85893d301186a0f8156fb702da379f) --- diff --git a/lib/plist.c b/lib/plist.c index cd9a0f299b..713eee25ed 100644 --- a/lib/plist.c +++ b/lib/plist.c @@ -1536,7 +1536,6 @@ 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); @@ -1544,6 +1543,8 @@ int prefix_bgp_show_prefix_list(struct vty *vty, afi_t afi, char *name, 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));