Commit 710176e8 authored by Alexander Aring's avatar Alexander Aring Committed by David Teigland

fs: dlm: check on minimum msglen size

This patch adds an additional check for minimum dlm header size which is
an invalid dlm message and signals a broken stream. A msglen field cannot
be less than the dlm header size because the field is inclusive header
lengths.
Signed-off-by: default avatarAlexander Aring <aahringo@redhat.com>
Signed-off-by: default avatarDavid Teigland <teigland@redhat.com>
parent f0747ebf
...@@ -49,9 +49,10 @@ int dlm_process_incoming_buffer(int nodeid, unsigned char *buf, int len) ...@@ -49,9 +49,10 @@ int dlm_process_incoming_buffer(int nodeid, unsigned char *buf, int len)
* cannot deliver this message to upper layers * cannot deliver this message to upper layers
*/ */
msglen = get_unaligned_le16(&hd->h_length); msglen = get_unaligned_le16(&hd->h_length);
if (msglen > DEFAULT_BUFFER_SIZE) { if (msglen > DEFAULT_BUFFER_SIZE ||
log_print("received invalid length header: %u, will abort message parsing", msglen < sizeof(struct dlm_header)) {
msglen); log_print("received invalid length header: %u from node %d, will abort message parsing",
msglen, nodeid);
return -EBADMSG; return -EBADMSG;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment