fixed off-by-one error; r=harishd

This commit is contained in:
rickg%netscape.com 2000-02-13 17:45:01 +00:00
parent a1e70679b1
commit 4e97c0877e

View File

@ -282,11 +282,13 @@ inline PRInt32 FindChar1(const char* aDest,PRUint32 aDestLength,PRInt32 anOffset
}
else {
PRInt32 theMax = aDestLength-anOffset;
char theChar=(char)aChar;
const char* result=(const char*)memchr(left, theChar, theMax);
if(result) {
return result-aDest;
PRInt32 theMax = end-left;
if(0<theMax) {
char theChar=(char)aChar;
const char* result=(const char*)memchr(left, theChar, theMax);
if(result) {
return result-aDest;
}
}
}
}