[Spice-commits] src/spice-channel.c
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Wed Nov 21 17:09:23 UTC 2018
src/spice-channel.c | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
New commits:
commit a750d0cbbb92011185a3a6d5e4f65815fe2acc8c
Author: Frediano Ziglio <fziglio at redhat.com>
Date: Tue Nov 20 14:18:03 2018 +0000
spice-channel: Adjust endianness in a single place for link message
Make sure all fields have right endian. "error" field was not adjusted.
Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
Acked-by: Christophe Fergeau <cfergeau at redhat.com>
diff --git a/src/spice-channel.c b/src/spice-channel.c
index 1b3578c..1486137 100644
--- a/src/spice-channel.c
+++ b/src/spice-channel.c
@@ -1913,6 +1913,12 @@ static gboolean spice_channel_recv_link_msg(SpiceChannel *channel)
c->name, __FUNCTION__, rc, c->peer_hdr.size);
goto error;
}
+
+ c->peer_msg->error = GUINT32_FROM_LE(c->peer_msg->error);
+ c->peer_msg->num_common_caps = GUINT32_FROM_LE(c->peer_msg->num_common_caps);
+ c->peer_msg->num_channel_caps = GUINT32_FROM_LE(c->peer_msg->num_channel_caps);
+ c->peer_msg->caps_offset = GUINT32_FROM_LE(c->peer_msg->caps_offset);
+
switch (c->peer_msg->error) {
case SPICE_LINK_ERR_OK:
/* nothing */
@@ -1928,8 +1934,8 @@ static gboolean spice_channel_recv_link_msg(SpiceChannel *channel)
goto error;
}
- num_channel_caps = GUINT32_FROM_LE(c->peer_msg->num_channel_caps);
- num_common_caps = GUINT32_FROM_LE(c->peer_msg->num_common_caps);
+ num_channel_caps = c->peer_msg->num_channel_caps;
+ num_common_caps = c->peer_msg->num_common_caps;
num_caps = num_channel_caps + num_common_caps;
CHANNEL_DEBUG(channel, "%s: %u caps", __FUNCTION__, num_caps);
@@ -1937,7 +1943,7 @@ static gboolean spice_channel_recv_link_msg(SpiceChannel *channel)
/* see original spice/client code: */
/* g_return_if_fail(c->peer_msg + c->peer_msg->caps_offset * sizeof(uint32_t) > c->peer_msg + c->peer_hdr.size); */
- caps_src = (uint8_t *)c->peer_msg + GUINT32_FROM_LE(c->peer_msg->caps_offset);
+ caps_src = (uint8_t *)c->peer_msg + c->peer_msg->caps_offset;
CHANNEL_DEBUG(channel, "got remote common caps:");
store_caps(caps_src, num_common_caps, c->remote_common_caps);
More information about the Spice-commits
mailing list