changeset 792:bee1f36efc16

Fix potential aliasing issues.
author Matti Hamalainen <ccr@tnsp.org>
date Wed, 07 Nov 2012 10:54:23 +0200
parents 0995fa233462
children 0617f844ebdb
files src/xs_support.c
diffstat 1 files changed, 2 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/xs_support.c	Tue Nov 06 16:34:06 2012 +0200
+++ b/src/xs_support.c	Wed Nov 07 10:54:23 2012 +0200
@@ -422,8 +422,8 @@
     xs_md5_bytereverse(ctx->in, 14);
 
     /* Append length in bits and transform */
-    ((guint32 *) ctx->in)[14] = ctx->bits[0];
-    ((guint32 *) ctx->in)[15] = ctx->bits[1];
+    memcpy(((guint32 *) ctx->in) + 14, &ctx->bits[0], sizeof(guint32));
+    memcpy(((guint32 *) ctx->in) + 15, &ctx->bits[1], sizeof(guint32));
 
     xs_md5_transform(ctx->buf, (guint32 *) ctx->in);
     xs_md5_bytereverse((guint8 *) ctx->buf, 4);