Skip to content

Commit

Permalink
Merge pull request FRRouting#14342 from fdumontet6WIND/fix_crash_snmp
Browse files Browse the repository at this point in the history
bgpd: fix crash in *bgpv2PeerErrorsTable"
  • Loading branch information
donaldsharp authored Sep 27, 2023
2 parents bb308b1 + b8f3f0b commit 60c38a9
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 @@ -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);
}
Expand Down
8 changes: 3 additions & 5 deletions bgpd/bgp_vty.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

}
Expand Down

0 comments on commit 60c38a9

Please sign in to comment.