[libsoup] WebSockets: Avoid unaligned memory access



commit c2aaac0083f58d285b8feb24f13fe347d7f726fe
Author: Rolf Eike Beer <eike sf-mail de>
Date:   Sat Mar 17 10:28:00 2018 +0000

    WebSockets: Avoid unaligned memory access
    
    This is causing test failures in SPARC architectures.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=794421

 libsoup/soup-websocket-connection.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
---
diff --git a/libsoup/soup-websocket-connection.c b/libsoup/soup-websocket-connection.c
index 0258a22..35eee6a 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;
        }
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]