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:37:08 +0000 (15:37 +1100)
commit9bf47667adbe4324b7587c61349b64affa5420c6
tree25b10bb5c7a31bd1e13c3ad6258ed3e56646934b
parent4a8590f76c5e7ea68acb4d5e52ec0e8a41b65fda
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