Skip to content

Commit

Permalink
Merge pull request #14497 from FRRouting/mergify/bp/stable/8.5/pr-14342
Browse files Browse the repository at this point in the history
bgpd: fix crash in *bgpv2PeerErrorsTable" (backport #14342)
  • Loading branch information
ton31337 authored Sep 28, 2023
2 parents 3db9954 + 9f99c26 commit b06b4ff
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
5 changes: 3 additions & 2 deletions bgpd/bgp_debug.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
8 changes: 3 additions & 5 deletions bgpd/bgp_vty.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

}
Expand Down

0 comments on commit b06b4ff

Please sign in to comment.