From 3c216378cba651dcb6519d7e615be37b534b56c8 Mon Sep 17 00:00:00 2001 From: Jeffrey Altman Date: Thu, 4 Oct 2007 15:11:07 +0000 Subject: [PATCH] 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. --- src/WINNT/afsd/cm_btree.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) 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 */ -- 2.39.5