mirror of
https://github.com/xen-project/xen.git
synced 2026-10-29 10:40:03 +01:00
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:
1 parent
cfa252b058
commit
014f9219f1
1 file changed
+6
@@ -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)
|
||||
|
||||