Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sbin/ping6 avoit type punning
details: https://anonhg.NetBSD.org/src/rev/83ff2a8ffd39
branches: trunk
changeset: 790662:83ff2a8ffd39
user: christos <christos%NetBSD.org@localhost>
date: Sat Oct 19 01:09:16 2013 +0000
description:
avoit type punning
diffstat:
sbin/ping6/ping6.c | 12 ++++++------
1 files changed, 6 insertions(+), 6 deletions(-)
diffs (47 lines):
diff -r 0d319c185359 -r 83ff2a8ffd39 sbin/ping6/ping6.c
--- a/sbin/ping6/ping6.c Sat Oct 19 01:08:25 2013 +0000
+++ b/sbin/ping6/ping6.c Sat Oct 19 01:09:16 2013 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ping6.c,v 1.81 2012/09/10 04:32:24 msaitoh Exp $ */
+/* $NetBSD: ping6.c,v 1.82 2013/10/19 01:09:16 christos Exp $ */
/* $KAME: ping6.c,v 1.164 2002/11/16 14:05:37 itojun Exp $ */
/*
@@ -77,7 +77,7 @@
#else
#include <sys/cdefs.h>
#ifndef lint
-__RCSID("$NetBSD: ping6.c,v 1.81 2012/09/10 04:32:24 msaitoh Exp $");
+__RCSID("$NetBSD: ping6.c,v 1.82 2013/10/19 01:09:16 christos Exp $");
#endif
#endif
@@ -703,8 +703,10 @@
ident = arc4random() & 0xFFFF;
memset(nonce, 0, sizeof(nonce));
- for (i = 0; i < sizeof(nonce); i += sizeof(u_int32_t))
- *((u_int32_t *)&nonce[i]) = arc4random();
+ for (i = 0; i < sizeof(nonce); i += sizeof(u_int32_t)) {
+ uint32_t r = arc4random();
+ memcpy(&nonce[i], &r, sizeof(r));
+ }
hold = 1;
@@ -1019,7 +1021,6 @@
for (;;) {
struct msghdr m;
- struct cmsghdr *cm;
u_char buf[1024];
struct iovec iov[2];
@@ -1067,7 +1068,6 @@
iov[0].iov_len = packlen;
m.msg_iov = iov;
m.msg_iovlen = 1;
- cm = (struct cmsghdr *)buf;
m.msg_control = (caddr_t)buf;
m.msg_controllen = sizeof(buf);
Home |
Main Index |
Thread Index |
Old Index