summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDonald Sharp <sharpd@nvidia.com>2020-09-23 19:04:20 +0200
committerDonald Sharp <sharpd@nvidia.com>2020-09-23 19:12:26 +0200
commit7692744f2c922e1621063ff4c44b94dff05bb6a9 (patch)
tree940f537d3bb37cee3d3ab9c9455620ebfa4823a4
parentzebra: modify mlag code to only need 1 stream when generating data (diff)
downloadfrr-7692744f2c922e1621063ff4c44b94dff05bb6a9.tar.xz
frr-7692744f2c922e1621063ff4c44b94dff05bb6a9.zip
zebra: Ensure that message received from mlag will fit
If we receive a message that is greater than our buffer size we are in a situation where both the read and write buffers are fubar'ed beyond the end. Assert when we notice this fact. Ticket: CM-31576 Signed-off-by: Donald Sharp <sharpd@nvidia.com>
-rw-r--r--zebra/zebra_mlag_private.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/zebra/zebra_mlag_private.c b/zebra/zebra_mlag_private.c
index 0f0285ed3..1dae758b1 100644
--- a/zebra/zebra_mlag_private.c
+++ b/zebra/zebra_mlag_private.c
@@ -117,6 +117,15 @@ static int zebra_mlag_read(struct thread *thread)
/* This will be the actual length of the packet */
tot_len = h_msglen + ZEBRA_MLAG_LEN_SIZE;
+ /*
+ * If the buffer read we are about to do is too large
+ * we are really really really not double plus good
+ *
+ * I'm not sure what to do here other than to bail
+ * We'll need to revisit this in the future.
+ */
+ assert(tot_len < ZEBRA_MLAG_BUF_LIMIT);
+
if (curr_len < tot_len) {
ssize_t data_len;