[Spice-devel] [PATCH spice-gtk 3/3] spice-channel: Fix endianness for SASL authentication
Frediano Ziglio
fziglio at redhat.com
Mon Jun 4 09:41:45 UTC 2018
Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
---
src/spice-channel.c | 16 +++++++++++-----
1 file changed, 11 insertions(+), 5 deletions(-)
diff --git a/src/spice-channel.c b/src/spice-channel.c
index 55ead158..a25397b7 100644
--- a/src/spice-channel.c
+++ b/src/spice-channel.c
@@ -1509,6 +1509,12 @@ spice_channel_gather_sasl_credentials(SpiceChannel *channel,
return ret;
}
+static void spice_channel_write_u32_le(SpiceChannel *channel, guint32 n)
+{
+ n = GUINT32_TO_LE(n);
+ spice_channel_write(channel, &n, sizeof(n));
+}
+
/*
*
* Init msg from server
@@ -1708,17 +1714,17 @@ restart:
/* Send back the chosen mechname */
len = strlen(mechname);
- spice_channel_write(channel, &len, sizeof(guint32));
+ spice_channel_write_u32_le(channel, len);
spice_channel_write(channel, mechname, len);
/* NB, distinction of NULL vs "" is *critical* in SASL */
if (clientout) {
len = clientoutlen + 1;
- spice_channel_write(channel, &len, sizeof(guint32));
+ spice_channel_write_u32_le(channel, len);
spice_channel_write(channel, clientout, len);
} else {
len = 0;
- spice_channel_write(channel, &len, sizeof(guint32));
+ spice_channel_write_u32_le(channel, len);
}
if (c->has_error)
@@ -1794,11 +1800,11 @@ restart:
/* NB, distinction of NULL vs "" is *critical* in SASL */
if (clientout) {
len = clientoutlen + 1;
- spice_channel_write(channel, &len, sizeof(guint32));
+ spice_channel_write_u32_le(channel, len);
spice_channel_write(channel, clientout, len);
} else {
len = 0;
- spice_channel_write(channel, &len, sizeof(guint32));
+ spice_channel_write_u32_le(channel, len);
}
if (c->has_error)
--
2.17.1
More information about the Spice-devel
mailing list