[PATCH] fix unaligned memory write



Sparc is extremely picky about unaligned accesses. Use memcpy() to make it 
work reliably. Compilers will usually optimize the memcpy away on 
architectures that support unaligned accesses.

See: https://bugs.gentoo.org/630516
---
--- 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;
        }
 

Attachment: signature.asc
Description: This is a digitally signed message part.



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