mercurial/mpatch.c
changeset 384 a29decbf7475
parent 282 97d83e7fbf2f
child 410 7c678976df3e
child 429 688d03d6997a
--- a/mercurial/mpatch.c	Thu Jun 16 22:32:55 2005 -0800
+++ b/mercurial/mpatch.c	Thu Jun 16 22:54:37 2005 -0800
@@ -195,15 +195,17 @@
 	struct flist *l;
 	struct frag *lt;
 	char *end = bin + len;
+	char decode[12]; /* for dealing with alignment issues */
 
 	/* assume worst case size, we won't have many of these lists */
 	l = lalloc(len / 12);
 	lt = l->tail;
 
 	while (bin < end) {
-		lt->start = ntohl(*(uint32_t *)bin);
-		lt->end = ntohl(*(uint32_t *)(bin + 4));
-		lt->len = ntohl(*(uint32_t *)(bin + 8));
+		memcpy(decode, bin, 12);
+		lt->start = ntohl(*(uint32_t *)decode);
+		lt->end = ntohl(*(uint32_t *)(decode + 4));
+		lt->len = ntohl(*(uint32_t *)(decode + 8));
 		lt->data = bin + 12;
 		bin += 12 + lt->len;
 		lt++;