Module Name: src
Committed By: christos
Date: Sun Oct 20 03:14:34 UTC 2013
Modified Files:
src/external/bsd/bind/dist/lib/isc: sha2.c
src/external/bsd/dhcpcd/dist: if-bsd.c
Log Message:
avoid pointer gymnastics
To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/external/bsd/bind/dist/lib/isc/sha2.c
cvs rdiff -u -r1.1.1.21 -r1.2 src/external/bsd/dhcpcd/dist/if-bsd.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/external/bsd/bind/dist/lib/isc/sha2.c
diff -u src/external/bsd/bind/dist/lib/isc/sha2.c:1.5 src/external/bsd/bind/dist/lib/isc/sha2.c:1.6
--- src/external/bsd/bind/dist/lib/isc/sha2.c:1.5 Mon Jun 4 20:42:31 2012
+++ src/external/bsd/bind/dist/lib/isc/sha2.c Sat Oct 19 23:14:34 2013
@@ -1,4 +1,4 @@
-/* $NetBSD: sha2.c,v 1.5 2012/06/05 00:42:31 christos Exp $ */
+/* $NetBSD: sha2.c,v 1.6 2013/10/20 03:14:34 christos Exp $ */
/*
* Copyright (C) 2005-2007, 2009, 2011, 2012 Internet Systems Consortium, Inc. ("ISC")
@@ -887,7 +887,8 @@ isc_sha256_final(isc_uint8_t digest[], i
*context->buffer = 0x80;
}
/* Set the bit count: */
- *(isc_uint64_t*)&context->buffer[ISC_SHA256_SHORT_BLOCK_LENGTH] = context->bitcount;
+ memcpy(&context->buffer[ISC_SHA256_SHORT_BLOCK_LENGTH],
+ &context->bitcount, sizeof(isc_uint64_t));
/* Final transform: */
isc_sha256_transform(context, (isc_uint32_t*)context->buffer);
@@ -1198,8 +1199,8 @@ void isc_sha512_last(isc_sha512_t *conte
*context->buffer = 0x80;
}
/* Store the length of input data (in bits): */
- *(isc_uint64_t*)&context->buffer[ISC_SHA512_SHORT_BLOCK_LENGTH] = context->bitcount[1];
- *(isc_uint64_t*)&context->buffer[ISC_SHA512_SHORT_BLOCK_LENGTH+8] = context->bitcount[0];
+ memcpy(&context->buffer[ISC_SHA512_SHORT_BLOCK_LENGTH+8],
+ &context->bitcount[0], sizeof(isc_uint64_t));
/* Final transform: */
isc_sha512_transform(context, (isc_uint64_t*)context->buffer);
Index: src/external/bsd/dhcpcd/dist/if-bsd.c
diff -u src/external/bsd/dhcpcd/dist/if-bsd.c:1.1.1.21 src/external/bsd/dhcpcd/dist/if-bsd.c:1.2
--- src/external/bsd/dhcpcd/dist/if-bsd.c:1.1.1.21 Fri Sep 20 06:51:29 2013
+++ src/external/bsd/dhcpcd/dist/if-bsd.c Sat Oct 19 23:14:34 2013
@@ -1,5 +1,5 @@
#include <sys/cdefs.h>
- __RCSID("$NetBSD: if-bsd.c,v 1.1.1.21 2013/09/20 10:51:29 roy Exp $");
+ __RCSID("$NetBSD: if-bsd.c,v 1.2 2013/10/20 03:14:34 christos Exp $");
/*
* dhcpcd - DHCP client daemon
@@ -383,8 +383,9 @@ if_route6(const struct rt6 *rt, int acti
#ifdef __KAME__
#define SCOPE { \
if (IN6_IS_ADDR_LINKLOCAL(&su.sin.sin6_addr)) { \
- *(uint16_t *)(void *)&su.sin.sin6_addr.s6_addr[2] = \
- htons(su.sin.sin6_scope_id); \
+ uint16_t scope = htons(su.sin.sin6_scope_id); \
+ memcpy(&su.sin.sin6_addr.s6_addr[2], &scope, \
+ sizeof(scope)); \
su.sin.sin6_scope_id = 0; \
} \
}