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)
committerRonnie Sahlberg <ronniesahlberg@gmail.com>
Tue, 7 Dec 2010 04:36:38 +0000 (15:36 +1100)
commit6ef0c82222bdae6cf4163b05e2488a582230c5e4
tree4e4d7cc14b32e729c15ceb1ef21efd4a9cc9bb7b
parentd22e7e47a7f3d450bbbc2267322dadbdbf192e84
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>
lib/util/idtree.c