From: Jeffrey Altman Date: Thu, 4 Oct 2007 15:11:07 +0000 (+0000) Subject: windows-btree-rename-case-only-20071004 X-Git-Tag: BP-openafs-windows-kdfs-ifs~472 X-Git-Url: https://git.michaelhowe.org/gitweb/?a=commitdiff_plain;h=3c216378cba651dcb6519d7e615be37b534b56c8;p=packages%2Fo%2Fopenafs.git 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. --- 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 */