summaryrefslogtreecommitdiffstats
path: root/lib/mlag.c
diff options
context:
space:
mode:
authorDonald Sharp <sharpd@cumulusnetworks.com>2020-03-18 12:15:05 +0100
committerDonald Sharp <sharpd@cumulusnetworks.com>2020-03-20 23:17:40 +0100
commitd1ba1814bc17c4c029e85552048e64eca78f5ce8 (patch)
tree47f20b710f4ff2749f776b56645bd8d6e437ca2f /lib/mlag.c
parentpimd: Prevent use after free (diff)
downloadfrr-d1ba1814bc17c4c029e85552048e64eca78f5ce8.tar.xz
frr-d1ba1814bc17c4c029e85552048e64eca78f5ce8.zip
lib: Ensure pointer exists before using in mlag
Ensure that the s pointer is valid and usable before grabbing data off of it. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Diffstat (limited to 'lib/mlag.c')
-rw-r--r--lib/mlag.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/mlag.c b/lib/mlag.c
index 733dd41ea..653fbe8fe 100644
--- a/lib/mlag.c
+++ b/lib/mlag.c
@@ -85,9 +85,12 @@ int mlag_lib_decode_mlag_hdr(struct stream *s, struct mlag_msg *msg,
size_t *length)
{
#define LIB_MLAG_HDR_LENGTH 8
+ if (s == NULL || msg == NULL)
+ return -1;
+
*length = stream_get_endp(s);
- if (s == NULL || msg == NULL || *length < LIB_MLAG_HDR_LENGTH)
+ if (*length < LIB_MLAG_HDR_LENGTH)
return -1;
*length -= LIB_MLAG_HDR_LENGTH;