summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2006-03-13 06:58:09 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:57:10 -0500
commit5afe03d9758dedc2d11208b7ed350c3128f9ad2d (patch)
tree22ca0f55e1622aa1209d3474bcb3af09d3e5b0e9
parentcd63d287dfcbf4db5af37c5346037f44c782d217 (diff)
downloadsamba-5afe03d9758dedc2d11208b7ed350c3128f9ad2d.tar.gz
samba-5afe03d9758dedc2d11208b7ed350c3128f9ad2d.tar.bz2
samba-5afe03d9758dedc2d11208b7ed350c3128f9ad2d.zip
r14308: fixed an out of range shift and an uninitialised error
(This used to be commit 9acc445a21b7f04eb980a05109f2c73d58221f1a)
-rw-r--r--source4/lib/util/idtree.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/source4/lib/util/idtree.c b/source4/lib/util/idtree.c
index d29c3b8fbd..c02a2636a1 100644
--- a/source4/lib/util/idtree.c
+++ b/source4/lib/util/idtree.c
@@ -107,6 +107,8 @@ static int sub_alloc(struct idr_context *idp, void *ptr, int *starting_id)
int l, id;
uint32_t bm;
+ memset(pa, 0, sizeof(pa));
+
id = *starting_id;
p = idp->top;
l = idp->layers;
@@ -271,7 +273,7 @@ static void *_idr_find(struct idr_context *idp, int id)
/* Mask off upper bits we don't use for the search. */
id &= MAX_ID_MASK;
- while (n > 0 && p) {
+ while (n >= IDR_BITS && p) {
n -= IDR_BITS;
p = p->ary[(id >> n) & IDR_MASK];
}