From a65179a2de98a5839ee22296f6b95d82b787f250 Mon Sep 17 00:00:00 2001 From: fgsch Date: Thu, 8 Nov 2001 07:20:08 +0000 Subject: [PATCH] Fix alignment problems; maintainer ok. These came from some patches submited to icqlib. --- .../patches/patch-icqlib-1_2_icqpacket_c | 79 +++++++++++++++++++ net/centericq/patches/patch-icqlib-1_2_udp_c | 22 ++++++ 2 files changed, 101 insertions(+) create mode 100644 net/centericq/patches/patch-icqlib-1_2_icqpacket_c create mode 100644 net/centericq/patches/patch-icqlib-1_2_udp_c diff --git a/net/centericq/patches/patch-icqlib-1_2_icqpacket_c b/net/centericq/patches/patch-icqlib-1_2_icqpacket_c new file mode 100644 index 00000000000..a8c42230cf7 --- /dev/null +++ b/net/centericq/patches/patch-icqlib-1_2_icqpacket_c @@ -0,0 +1,79 @@ +$OpenBSD: patch-icqlib-1_2_icqpacket_c,v 1.1 2001/11/08 07:20:08 fgsch Exp $ +--- icqlib-1.2/icqpacket.c.orig Sat Jun 2 04:10:45 2001 ++++ icqlib-1.2/icqpacket.c Mon Nov 5 23:35:29 2001 +@@ -65,7 +65,8 @@ void icq_PacketAppend32(icq_Packet *p, D + { + DWORD val=i; + +- *(unsigned long*)((p->data)+(p->cursor))=htoicql(val); ++ val = htoicql(val); ++ memcpy((p->data) + (p->cursor), &val, sizeof(DWORD)); + icq_PacketAdvance(p, sizeof(DWORD)); + } + +@@ -73,7 +74,7 @@ void icq_PacketAppend32n(icq_Packet *p, + { + DWORD val=i; + +- *(DWORD *)((p->data)+(p->cursor)) = val; ++ memcpy((p->data) + (p->cursor), &val, sizeof(DWORD)); + icq_PacketAdvance(p, sizeof(DWORD)); + } + +@@ -81,7 +82,8 @@ DWORD icq_PacketRead32(icq_Packet *p) + { + DWORD val; + +- val = icqtohl(*(DWORD *)((p->data)+(p->cursor))); ++ memcpy(&val,(p->data) + (p->cursor), sizeof(DWORD)); ++ val = icqtohl(val); + icq_PacketAdvance(p, sizeof(DWORD)); + + return val; +@@ -91,7 +93,7 @@ DWORD icq_PacketRead32n(icq_Packet *p) + { + DWORD val; + +- val = *(DWORD*)((p->data)+(p->cursor)); ++ memcpy(&val,(p->data) + (p->cursor), sizeof(DWORD)); + icq_PacketAdvance(p, sizeof(DWORD)); + + return val; +@@ -101,7 +103,8 @@ void icq_PacketAppend16(icq_Packet *p, W + { + WORD val=i; + +- *(WORD *)((p->data)+(p->cursor)) = htoicqs(val); ++ val = htoicqs(val); ++ memcpy((p->data) + (p->cursor), &val, sizeof(WORD)); + icq_PacketAdvance(p, sizeof(WORD)); + } + +@@ -109,7 +112,7 @@ void icq_PacketAppend16n(icq_Packet *p, + { + WORD val=i; + +- *(WORD *)((p->data)+(p->cursor)) = val; ++ memcpy((p->data) + (p->cursor), &val, sizeof(WORD)); + icq_PacketAdvance(p, sizeof(WORD)); + } + +@@ -117,7 +120,8 @@ WORD icq_PacketRead16(icq_Packet *p) + { + WORD val; + +- val = icqtohs(*(WORD *)((p->data)+(p->cursor))); ++ memcpy(&val, (p->data) + (p->cursor), sizeof(WORD)); ++ val = icqtohs(val); + icq_PacketAdvance(p, sizeof(WORD)); + + return val; +@@ -127,7 +131,7 @@ WORD icq_PacketRead16n(icq_Packet *p) + { + WORD val; + +- val = *(WORD*)((p->data)+(p->cursor)); ++ memcpy(&val,(p->data) + (p->cursor), sizeof(WORD)); + icq_PacketAdvance(p, sizeof(WORD)); + + return val; diff --git a/net/centericq/patches/patch-icqlib-1_2_udp_c b/net/centericq/patches/patch-icqlib-1_2_udp_c new file mode 100644 index 00000000000..bccde3c3e22 --- /dev/null +++ b/net/centericq/patches/patch-icqlib-1_2_udp_c @@ -0,0 +1,22 @@ +$OpenBSD: patch-icqlib-1_2_udp_c,v 1.1 2001/11/08 07:20:08 fgsch Exp $ +--- icqlib-1.2/udp.c.orig Wed Oct 3 15:35:04 2001 ++++ icqlib-1.2/udp.c Mon Nov 5 23:43:53 2001 +@@ -134,12 +134,15 @@ void icq_UDPEncode(icq_Packet *p) + for(; pos < p->length; pos+=4) + { + code3 = code2 + icq_UDPTable[pos & 0xFF]; +- data = icqtohl(*(DWORD *)((p->data)+pos)); ++ memcpy(&data, ((p->data) + pos), sizeof(DWORD)); ++ data = icqtohl(data); + data ^= code3; +- *(DWORD*)((p->data)+pos)=htoicql(data); ++ data = htoicql(data); ++ memcpy((p->data)+pos, &data, sizeof(DWORD)); + } + checkcode = icq_UDPScramble(checkcode); +- *(DWORD *)((p->data)+0x14)=htoicql(checkcode); ++ checkcode = htoicql(checkcode); ++ memcpy((p->data)+0x14, &checkcode, sizeof(DWORD)); + } + + /*********************************************************