diff options
author | Martin Hedenfal <martinh@cvs.openbsd.org> | 2010-07-26 09:27:15 +0000 |
---|---|---|
committer | Martin Hedenfal <martinh@cvs.openbsd.org> | 2010-07-26 09:27:15 +0000 |
commit | ee1ef654703a2d302b8e4a7e08ab96ca73f4c09a (patch) | |
tree | fdbc7d617c8394859b2d865a6dab20977c278643 /usr.sbin | |
parent | 789ef983157a8a78a89acb3e6fc1b6a314698e4d (diff) |
Fix a sigbus due to unaligned memory access, found when compacting on
sparc64.
reads ok to gilles@
Diffstat (limited to 'usr.sbin')
-rw-r--r-- | usr.sbin/ldapd/btree.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/usr.sbin/ldapd/btree.c b/usr.sbin/ldapd/btree.c index 6b4f75f563b..af2020bb256 100644 --- a/usr.sbin/ldapd/btree.c +++ b/usr.sbin/ldapd/btree.c @@ -1,4 +1,4 @@ -/* $OpenBSD: btree.c,v 1.28 2010/07/18 15:15:40 martinh Exp $ */ +/* $OpenBSD: btree.c,v 1.29 2010/07/26 09:27:14 martinh Exp $ */ /* * Copyright (c) 2009, 2010 Martin Hedenfalk <martin@bzero.se> @@ -2992,7 +2992,7 @@ btree_compact_tree(struct btree *bt, pgno_t pgno, struct btree *btc) { ssize_t rc; indx_t i; - pgno_t *pnext; + pgno_t *pnext, next; struct node *node; struct page *p; struct mpage *mp; @@ -3021,12 +3021,13 @@ btree_compact_tree(struct btree *bt, pgno_t pgno, struct btree *btc) for (i = 0; i < NUMKEYSP(p); i++) { node = NODEPTRP(p, i); if (F_ISSET(node->flags, F_BIGDATA)) { - pnext = NODEDATA(node); - *pnext = btree_compact_tree(bt, *pnext, btc); - if (*pnext == P_INVALID) { + bcopy(NODEDATA(node), &next, sizeof(next)); + next = btree_compact_tree(bt, next, btc); + if (next == P_INVALID) { free(p); return P_INVALID; } + bcopy(&next, NODEDATA(node), sizeof(next)); } } } else if (F_ISSET(p->flags, P_OVERFLOW)) { |