summaryrefslogtreecommitdiffstats
path: root/bgpd/bgp_packet.c
diff options
context:
space:
mode:
authorQuentin Young <qlyoung@cumulusnetworks.com>2018-04-11 18:54:42 +0200
committerQuentin Young <qlyoung@cumulusnetworks.com>2018-04-13 23:17:42 +0200
commite0981960cdc9bf40d610267b0b743571db78ff35 (patch)
tree6bf2c5380bc4a73c9fb43eae13293fd9e5597fea /bgpd/bgp_packet.c
parentospf6d: remove ospf6_interface_if_del (diff)
downloadfrr-e0981960cdc9bf40d610267b0b743571db78ff35.tar.xz
frr-e0981960cdc9bf40d610267b0b743571db78ff35.zip
bgpd: double-check notify data when debugging
clang-analyze complains that data may be null, and since we didn't explicitly check it (although we did check the overall packet length minus the header length) it has a point. Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
Diffstat (limited to '')
-rw-r--r--bgpd/bgp_packet.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/bgpd/bgp_packet.c b/bgpd/bgp_packet.c
index f0b30f018..1a08a0512 100644
--- a/bgpd/bgp_packet.c
+++ b/bgpd/bgp_packet.c
@@ -697,13 +697,13 @@ void bgp_notify_send_with_data(struct peer *peer, uint8_t code,
bgp_notify.code = code;
bgp_notify.subcode = sub_code;
bgp_notify.data = NULL;
- bgp_notify.length = length - BGP_MSG_NOTIFY_MIN_SIZE;
+ bgp_notify.length = datalen;
bgp_notify.raw_data = data;
peer->notify.code = bgp_notify.code;
peer->notify.subcode = bgp_notify.subcode;
- if (bgp_notify.length) {
+ if (bgp_notify.length && data) {
bgp_notify.data =
XMALLOC(MTYPE_TMP, bgp_notify.length * 3);
for (i = 0; i < bgp_notify.length; i++)