diff options
| author | Donald Sharp <donaldsharp72@gmail.com> | 2023-09-27 15:25:38 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-09-27 15:25:38 -0400 |
| commit | 60c38a99ac8fc447b02370e5b393d76128c2909e (patch) | |
| tree | d036752be7346bd06deabe0a52b2d48ce1745d26 /bgpd | |
| parent | bb308b1efc2e902c96ffe047bc6394a8da3a16d3 (diff) | |
| parent | b8f3f0b86ff3fae4a3e655811680bc11b18fd0e2 (diff) | |
Merge pull request #14342 from fdumontet6WIND/fix_crash_snmp
bgpd: fix crash in *bgpv2PeerErrorsTable"
Diffstat (limited to 'bgpd')
| -rw-r--r-- | bgpd/bgp_debug.c | 5 | ||||
| -rw-r--r-- | bgpd/bgp_vty.c | 8 |
2 files changed, 6 insertions, 7 deletions
diff --git a/bgpd/bgp_debug.c b/bgpd/bgp_debug.c index 0ff8bdcbbe..35f83062de 100644 --- a/bgpd/bgp_debug.c +++ b/bgpd/bgp_debug.c @@ -500,12 +500,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 08c14df1fe..9b4d893682 100644 --- a/bgpd/bgp_vty.c +++ b/bgpd/bgp_vty.c @@ -11310,11 +11310,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); } } |
