summaryrefslogtreecommitdiff
path: root/ospfclient/ospf_apiclient.c
diff options
context:
space:
mode:
Diffstat (limited to 'ospfclient/ospf_apiclient.c')
-rw-r--r--ospfclient/ospf_apiclient.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/ospfclient/ospf_apiclient.c b/ospfclient/ospf_apiclient.c
index e84c6f5b3c..b5e6389d4c 100644
--- a/ospfclient/ospf_apiclient.c
+++ b/ospfclient/ospf_apiclient.c
@@ -439,6 +439,12 @@ int ospf_apiclient_lsa_originate(struct ospf_apiclient *oclient,
struct lsa_header *lsah;
uint32_t tmp;
+ /* Validate opaque LSA length */
+ if ((size_t)opaquelen > sizeof(buf) - sizeof(struct lsa_header)) {
+ fprintf(stderr, "opaquelen(%d) is larger than buf size %zu\n",
+ opaquelen, sizeof(buf));
+ return OSPF_API_NOMEMORY;
+ }
/* We can only originate opaque LSAs */
if (!IS_OPAQUE_LSA(lsa_type)) {