idtree: fix overflow for v. large ids on allocation and removal
authorRusty Russell <rusty@rustcorp.com.au>
Mon, 6 Dec 2010 03:22:38 +0000 (13:52 +1030)
committerMichael Adam <obnox@samba.org>
Wed, 14 Aug 2013 21:01:16 +0000 (23:01 +0200)
commitb4bf0247ede40f2bbf39391ed9864dc041830fe8
treeb461aa728d9de97ddc009d4fa2be011d987b1ea0
parent7be3abc69333f58602ebf871d38ec138b908a36c
idtree: fix overflow for v. large ids on allocation and removal

(Imported from SAMBA commit 09a6538969ac).

Chris Cowan tracked down a SEGV in sub_alloc: idp->level can actually
be equal to 7 (MAX_LEVEL) there, as it can be in sub_remove.

(We unfairly blamed a shift of a signed var for this crash in commit
 2db1987f5a3a).

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
(cherry picked from commit 73764104356d3738d9d20a9d06ce51535f74f475)
lib/util/idtree.c