summaryrefslogtreecommitdiff
path: root/lib/route_opaque.h
diff options
context:
space:
mode:
authorIgor Ryzhov <iryzhov@nfware.com>2021-08-06 17:09:46 +0300
committerIgor Ryzhov <iryzhov@nfware.com>2021-08-06 17:09:46 +0300
commitb5bb70e3779f4e9dcf93edc64c7c47bda533bcd7 (patch)
tree1aaa48d214b50b4221a06c1a785af98ef1cfa10f /lib/route_opaque.h
parenta9bf0ff26805e8cb7ff247451ecc8ad6f0c6ad57 (diff)
bgpd: add protection against too large opaque data structure
BGP opaque data shouldn't be larger than zebra's buffer. Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
Diffstat (limited to 'lib/route_opaque.h')
-rw-r--r--lib/route_opaque.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/route_opaque.h b/lib/route_opaque.h
index fd4e3d5891..7c4e9a16e1 100644
--- a/lib/route_opaque.h
+++ b/lib/route_opaque.h
@@ -21,6 +21,9 @@
#ifndef FRR_ROUTE_OPAQUE_H
#define FRR_ROUTE_OPAQUE_H
+#include "assert.h"
+#include "zclient.h"
+
#include "bgpd/bgp_aspath.h"
#include "bgpd/bgp_community.h"
#include "bgpd/bgp_lcommunity.h"
@@ -35,4 +38,7 @@ struct bgp_zebra_opaque {
char lcommunity[LCOMMUNITY_SIZE * 30];
};
+static_assert(sizeof(struct bgp_zebra_opaque) <= ZAPI_MESSAGE_OPAQUE_LENGTH,
+ "BGP opaque data shouldn't be larger than zebra's buffer");
+
#endif /* FRR_ROUTE_OPAQUE_H */