summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2000-11-17 00:08:42 +0000
committerAndrew Tridgell <tridge@samba.org>2000-11-17 00:08:42 +0000
commit7c8e73e9435a740836acbbe677837bc9c3c63b1b (patch)
tree92a01fa703a6bada16b2c42f9df657408d377c76
parent2add9223231a710c7935fddd39f1a25b1a3c4462 (diff)
downloadsamba-7c8e73e9435a740836acbbe677837bc9c3c63b1b.tar.gz
samba-7c8e73e9435a740836acbbe677837bc9c3c63b1b.tar.bz2
samba-7c8e73e9435a740836acbbe677837bc9c3c63b1b.zip
the duplicate checking code will cause unaligned accesses on non-intel
processors. Fixed. (This used to be commit 64d38c24100cb3409b38b9923734f2a6202bdc2a)
-rw-r--r--source3/lib/messages.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/source3/lib/messages.c b/source3/lib/messages.c
index 0f3638ada2..8b50533610 100644
--- a/source3/lib/messages.c
+++ b/source3/lib/messages.c
@@ -195,11 +195,9 @@ BOOL message_send_pid(pid_t pid, int msg_type, void *buf, size_t len, BOOL dupli
if (!duplicates_allowed) {
char *ptr;
- struct message_rec *prec;
+ struct message_rec prec;
- for(ptr = (char *)dbuf.dptr, prec = (struct message_rec *)ptr; ptr < dbuf.dptr + dbuf.dsize;
- ptr += (sizeof(rec) + prec->len), prec = (struct message_rec *)ptr) {
-
+ for(ptr = (char *)dbuf.dptr; ptr < dbuf.dptr + dbuf.dsize; ) {
/*
* First check if the message header matches, then, if it's a non-zero
* sized message, check if the data matches. If so it's a duplicate and
@@ -214,6 +212,8 @@ BOOL message_send_pid(pid_t pid, int msg_type, void *buf, size_t len, BOOL dupli
return True;
}
}
+ memcpy(&prec, ptr, sizeof(prec));
+ ptr += sizeof(rec) + prec.len;
}
}