From 35752c6cebd20a5777cadd854a0db4e4a1d05ede Mon Sep 17 00:00:00 2001 From: "rickg%netscape.com" Date: Fri, 24 Mar 2000 07:19:00 +0000 Subject: [PATCH] correct off-by-one error (edge case); r=buster --- string/obsolete/nsStr.cpp | 2 +- xpcom/ds/nsStr.cpp | 2 +- xpcom/string/obsolete/nsStr.cpp | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/string/obsolete/nsStr.cpp b/string/obsolete/nsStr.cpp index e7592bdaea9..793eb1e5bfe 100644 --- a/string/obsolete/nsStr.cpp +++ b/string/obsolete/nsStr.cpp @@ -341,7 +341,7 @@ void nsStr::Trim(nsStr& aDest,const char* aSet,PRBool aEliminateLeading,PRBool a if(aEliminateTrailing) { theIndex=aDest.mLength; PRInt32 theNewLen=theIndex; - while(--theIndex>0) { + while(--theIndex>=0) { PRUnichar theChar=GetCharAt(aDest,theIndex); //read at end now... PRInt32 thePos=gFindChars[eOneByte](aSet,theSetLen,0,theChar,PR_FALSE,theSetLen); if(kNotFound0) { + while(--theIndex>=0) { PRUnichar theChar=GetCharAt(aDest,theIndex); //read at end now... PRInt32 thePos=gFindChars[eOneByte](aSet,theSetLen,0,theChar,PR_FALSE,theSetLen); if(kNotFound0) { + while(--theIndex>=0) { PRUnichar theChar=GetCharAt(aDest,theIndex); //read at end now... PRInt32 thePos=gFindChars[eOneByte](aSet,theSetLen,0,theChar,PR_FALSE,theSetLen); if(kNotFound