summaryrefslogtreecommitdiff
path: root/ospfd/ospf_api.c
diff options
context:
space:
mode:
authorJafar Al-Gharaibeh <jafar@atcorp.com>2025-02-06 17:20:22 -0600
committerGitHub <noreply@github.com>2025-02-06 17:20:22 -0600
commit3d61bbe0d9aa2785a6deb1d8465be2b0956891c7 (patch)
tree6db0434c41c4848845cb4519ea1e06d6471d5eb5 /ospfd/ospf_api.c
parent8b5df229061e92bee844a20e3fcc292edd8f7f7b (diff)
parentae8ee154efb45825179e9999312c347275093bf2 (diff)
Merge pull request #18042 from FRRouting/mergify/bp/dev/10.3/pr-17865
Coverity 2024 new hotness (backport #17865)
Diffstat (limited to 'ospfd/ospf_api.c')
-rw-r--r--ospfd/ospf_api.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/ospfd/ospf_api.c b/ospfd/ospf_api.c
index 213ee8c1fd..cfc13fcc53 100644
--- a/ospfd/ospf_api.c
+++ b/ospfd/ospf_api.c
@@ -514,6 +514,12 @@ struct msg *new_msg_originate_request(uint32_t seqnum, struct in_addr ifaddr,
omsglen += sizeof(struct msg_originate_request)
- sizeof(struct lsa_header);
+ if (omsglen > UINT16_MAX) {
+ zlog_warn("%s: LSA specified is bigger than maximum LSA size, something is wrong",
+ __func__);
+ omsglen = UINT16_MAX;
+ }
+
return msg_new(MSG_ORIGINATE_REQUEST, omsg, seqnum, omsglen);
}
@@ -639,6 +645,12 @@ struct msg *new_msg_lsa_change_notify(uint8_t msgtype, uint32_t seqnum,
memcpy(nmsg_data, data, len);
len += sizeof(struct msg_lsa_change_notify) - sizeof(struct lsa_header);
+ if (len > UINT16_MAX) {
+ zlog_warn("%s: LSA specified is bigger than maximum LSA size, something is wrong",
+ __func__);
+ len = UINT16_MAX;
+ }
+
return msg_new(msgtype, nmsg, seqnum, len);
}
@@ -666,6 +678,12 @@ struct msg *new_msg_reachable_change(uint32_t seqnum, uint16_t nadd,
nmsg->nremove = htons(nremove);
len = sizeof(*nmsg) + insz * (nadd + nremove);
+ if (len > UINT16_MAX) {
+ zlog_warn("%s: LSA specified is bigger than maximum LSA size, something is wrong",
+ __func__);
+ len = UINT16_MAX;
+ }
+
return msg_new(MSG_REACHABLE_CHANGE, nmsg, seqnum, len);
}