--- a/libsoup/soup-websocket-connection.c	2017-11-24 17:55:58.119804106 +0100
+++ b/libsoup/soup-websocket-connection.c	2017-11-24 17:58:35.169798836 +0100
@@ -395,9 +395,10 @@
 	 * 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;
 	}
 
