diff --git a/htmlparser/src/nsHTMLTokens.cpp b/htmlparser/src/nsHTMLTokens.cpp
index 5af921f049c8..46ef0111d83f 100644
--- a/htmlparser/src/nsHTMLTokens.cpp
+++ b/htmlparser/src/nsHTMLTokens.cpp
@@ -351,10 +351,8 @@ nsresult CEndToken::Consume(PRUnichar aChar, nsScanner& aScanner,PRInt32 aMode)
nsresult result=aScanner.ReadUntil(mTextValue,kGreaterThan,PR_FALSE);
if(NS_OK==result){
-
- PRInt32 theIndex=mTextValue.FindCharInSet(" \r\n\t\b",0);
- nsAutoString buffer(mTextValue);
- buffer.Truncate(theIndex);
+ nsAutoString buffer;
+ buffer.Assign(mTextValue, mTextValue.FindCharInSet(" \r\n\t\b",0));
mTypeID= nsHTMLTags::LookupTag(buffer);
result=aScanner.GetChar(aChar); //eat the closing '>;
}
diff --git a/parser/htmlparser/src/nsHTMLTokens.cpp b/parser/htmlparser/src/nsHTMLTokens.cpp
index 5af921f049c8..46ef0111d83f 100644
--- a/parser/htmlparser/src/nsHTMLTokens.cpp
+++ b/parser/htmlparser/src/nsHTMLTokens.cpp
@@ -351,10 +351,8 @@ nsresult CEndToken::Consume(PRUnichar aChar, nsScanner& aScanner,PRInt32 aMode)
nsresult result=aScanner.ReadUntil(mTextValue,kGreaterThan,PR_FALSE);
if(NS_OK==result){
-
- PRInt32 theIndex=mTextValue.FindCharInSet(" \r\n\t\b",0);
- nsAutoString buffer(mTextValue);
- buffer.Truncate(theIndex);
+ nsAutoString buffer;
+ buffer.Assign(mTextValue, mTextValue.FindCharInSet(" \r\n\t\b",0));
mTypeID= nsHTMLTags::LookupTag(buffer);
result=aScanner.GetChar(aChar); //eat the closing '>;
}