diff --git a/bgpd/bgp_debug.c b/bgpd/bgp_debug.c index f01c3e4f3570..e4e6c9d72154 100644 --- a/bgpd/bgp_debug.c +++ b/bgpd/bgp_debug.c @@ -514,12 +514,13 @@ const char *bgp_notify_subcode_str(char code, char subcode) const char *bgp_notify_admin_message(char *buf, size_t bufsz, uint8_t *data, size_t datalen) { + memset(buf, 0, bufsz); if (!data || datalen < 1) - return NULL; + return buf; uint8_t len = data[0]; if (!len || len > datalen - 1) - return NULL; + return buf; return zlog_sanitize(buf, bufsz, data + 1, len); } diff --git a/bgpd/bgp_vty.c b/bgpd/bgp_vty.c index 887fecd3166d..74bbd51c0577 100644 --- a/bgpd/bgp_vty.c +++ b/bgpd/bgp_vty.c @@ -10769,11 +10769,9 @@ static void bgp_show_peer_reset(struct vty * vty, struct peer *peer, msgbuf, sizeof(msgbuf), (uint8_t *)peer->notify.data, peer->notify.length); - if (msg_str) - json_object_string_add( - json_peer, - "lastShutdownDescription", - msg_str); + json_object_string_add(json_peer, + "lastShutdownDescription", + msg_str); } }