summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRolf Eike Beer <eike@sf-mail.de>2018-03-17 10:28:00 +0000
committerClaudio Saavedra <csaavedra@igalia.com>2018-03-19 11:06:15 +0200
commitc2aaac0083f58d285b8feb24f13fe347d7f726fe (patch)
treec412399a6df2d7e54f42c7f7b7eb5ac0fd10da4e
parente1cc71207a17a1742092a25fdfd0f4e168b75c68 (diff)
downloadlibsoup-c2aaac0083f58d285b8feb24f13fe347d7f726fe.tar.gz
WebSockets: Avoid unaligned memory access
This is causing test failures in SPARC architectures. https://bugzilla.gnome.org/show_bug.cgi?id=794421
-rw-r--r--libsoup/soup-websocket-connection.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/libsoup/soup-websocket-connection.c b/libsoup/soup-websocket-connection.c
index 0258a22c..35eee6a6 100644
--- a/libsoup/soup-websocket-connection.c
+++ b/libsoup/soup-websocket-connection.c
@@ -401,9 +401,10 @@ send_message (SoupWebsocketConnection *self,
* probably a client somewhere that's not expecting it.
*/
if (self->pv->connection_type == SOUP_WEBSOCKET_CONNECTION_CLIENT) {
+ guint32 rnd = g_random_int ();
outer[1] |= 0x80;
mask = outer + bytes->len;
- * ((guint32 *)mask) = g_random_int ();
+ memcpy (mask, &rnd, sizeof (rnd));
bytes->len += 4;
}