Package: rdate / 1:1.2-6

02-434140-unaligned-read.patch Patch series | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=434140

unaligned access in ntp code triggers SIGBUS on sparc, others

Frans Pop's testing of rdate on sparc reveals that the ntp option fails with
a SIGBUS, because the ntp code performs an unaligned 64-bit read when from
the packet data.  This definitely affects sparc, and will also affect a
number of other archs, either causing an unnecessary performance penalty or
causing the same SIGBUS.

Steve Langasek <vorlon@debian.org>  Sat, 21 Jul 2007 13:51:43 -0700

Index: rdate-1.2/src/ntp.c
===================================================================
--- rdate-1.2.orig/src/ntp.c
+++ rdate-1.2/src/ntp.c
@@ -429,7 +429,7 @@ unpack_ntp(struct ntp_data *data, u_char
 	data->transmit = d / NTP_SCALE;
 
 	/* See write_packet for why this isn't an endian problem. */
-	data->recvck = *(u_int64_t *)(packet + NTP_ORIGINATE);
+	memcpy(&data->recvck,packet+NTP_ORIGINATE,8);
 }
 
 /*