9pfs/proxy: Check return value of proxy_marshal()

This should always successfully write exactly two 32-bit integers.
Make it clear with an assert(), like v9fs_receive_status() and
v9fs_receive_response() already do when unmarshalling the same
header.

Fixes: Coverity CID 1438968
Reviewed-by: Christian Schoenebeck <qemu_oss@crudebyte.com>
Message-Id: <161035859647.1221144.4691749806675653934.stgit@bahia.lan>
Signed-off-by: Greg Kurz <groug@kaod.org>
This commit is contained in:
Greg Kurz 2021-01-11 10:49:56 +01:00
parent fef80ea073
commit acef3f8b47

View File

@ -537,7 +537,8 @@ static int v9fs_request(V9fsProxy *proxy, int type, void *response, ...)
}
/* marshal the header details */
proxy_marshal(iovec, 0, "dd", header.type, header.size);
retval = proxy_marshal(iovec, 0, "dd", header.type, header.size);
assert(retval == 4 * 2);
header.size += PROXY_HDR_SZ;
retval = qemu_write_full(proxy->sockfd, iovec->iov_base, header.size);