diff --git a/lib/util/idtree.c b/lib/util/idtree.c index 2104c741f3e..e2cfcc50315 100644 --- a/lib/util/idtree.c +++ b/lib/util/idtree.c @@ -181,8 +181,13 @@ restart: */ n = id; while (p->bitmap == IDR_FULL) { - if (!(p = pa[++l])) + if (l >= MAX_LEVEL) { break; + } + p = pa[++l]; + if (p == NULL) { + break; + } n = n >> IDR_BITS; set_bit((n & IDR_MASK), p->bitmap); }