xenstore: sanity check incoming message body lengths

This is for the client-side receiving messages from xenstored, so there
is no security impact, unlike XSA-72.

Coverity-ID: 1055449
Coverity-ID: 1056028
Signed-off-by: Matthew Daley <mattd@bugfuzz.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
(cherry picked from commit 8da1ed9031)
This commit is contained in:
Matthew Daley authored and Ian Jackson committed 2014-01-09 12:25:47 +00:00
1 parent cfa252b058
commit 014f9219f1
1 file changed
+6
+6
View File
@@ -1141,6 +1141,12 @@ static int read_message(struct xs_handle *h, int nonblocking)
goto error_freemsg;
}
/* Sanity check message body length. */
if (msg->hdr.len > XENSTORE_PAYLOAD_MAX) {
saved_errno = E2BIG;
goto error_freemsg;
}
/* Allocate and read the message body. */
body = msg->body = malloc(msg->hdr.len + 1);
if (body == NULL)
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.