summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiod Vallat <miod@cvs.openbsd.org>2014-06-08 14:17:53 +0000
committerMiod Vallat <miod@cvs.openbsd.org>2014-06-08 14:17:53 +0000
commit79a747f9a5c33f381dfdd043515af552c25abb4e (patch)
treed9488215fe2a6a0dfda10b93ba43ae78bde06a89
parentf96e5cac71aba92bd5bc9bbc0b9b1d15c4b1f50d (diff)
Use memcpy to copy the sogetopt() SO_SPLICE off_t value, for it may not be
correctly aligned. Similar in spirit to 1.119.
-rw-r--r--sys/kern/uipc_socket.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/sys/kern/uipc_socket.c b/sys/kern/uipc_socket.c
index f51c7c92780..0bc3e464e3d 100644
--- a/sys/kern/uipc_socket.c
+++ b/sys/kern/uipc_socket.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: uipc_socket.c,v 1.127 2014/04/07 10:04:17 mpi Exp $ */
+/* $OpenBSD: uipc_socket.c,v 1.128 2014/06/08 14:17:52 miod Exp $ */
/* $NetBSD: uipc_socket.c,v 1.21 1996/02/04 02:17:52 christos Exp $ */
/*
@@ -1733,7 +1733,8 @@ sogetopt(struct socket *so, int level, int optname, struct mbuf **mp)
int s = splsoftnet();
m->m_len = sizeof(off_t);
- *mtod(m, off_t *) = so->so_splicelen;
+ memcpy(mtod(m, off_t *), &so->so_splicelen,
+ sizeof(off_t));
splx(s);
break;
}