From: Jeffrey Altman Date: Thu, 4 Oct 2007 15:13:10 +0000 (+0000) Subject: DEVEL15-windows-btree-rename-case-only-20071004 X-Git-Tag: openafs-devel-1_5_26~53 X-Git-Url: https://git.michaelhowe.org/gitweb/?a=commitdiff_plain;h=9539218659950a5cc74ba5814217f6e16db05777;p=packages%2Fo%2Fopenafs.git DEVEL15-windows-btree-rename-case-only-20071004 Attempts to rename by case only would fail when there are more than one ambiguous matches. The list of data nodes would be corrupted and future tree manipulations could result in a crash. (cherry picked from commit 3c216378cba651dcb6519d7e615be37b534b56c8) --- diff --git a/src/WINNT/afsd/cm_btree.c b/src/WINNT/afsd/cm_btree.c index 26128eb98..884f9fdb7 100644 --- a/src/WINNT/afsd/cm_btree.c +++ b/src/WINNT/afsd/cm_btree.c @@ -733,14 +733,17 @@ descendBalance(Tree *B, Nptr curr, Nptr left, Nptr right, Nptr lAnc, Nptr rAnc, * options. So we must determine if any of the next nodes * are the one we are looking for. */ - Nptr dataNode = newNode; + Nptr prev = newNode; while ( next ) { if (!comparekeys(B)(getfunkey(B), getdatakey(next), EXACT_MATCH)) { /* we found the one to delete */ - getdatanext(dataNode) = getdatanext(next); + getdatanext(prev) = getdatanext(next); putFreeNode(B, next); + break; } + prev = next; + next = getdatanext(next); } /* do not delete the key */