diff --git a/htmlparser/src/nsHTMLTokens.cpp b/htmlparser/src/nsHTMLTokens.cpp
index 1002cb1fe74..e4fce8c5adb 100644
--- a/htmlparser/src/nsHTMLTokens.cpp
+++ b/htmlparser/src/nsHTMLTokens.cpp
@@ -1469,7 +1469,7 @@ void CAttributeToken::SanitizeKey() {
// legal part
if (iter != --end) {
nsAutoString str;
- CopyUnicodeTo(begin, iter, str);
+ CopyUnicodeTo(begin, ++iter, str);
mTextKey.Rebind(str);
}
}
diff --git a/parser/htmlparser/src/nsHTMLTokens.cpp b/parser/htmlparser/src/nsHTMLTokens.cpp
index 1002cb1fe74..e4fce8c5adb 100644
--- a/parser/htmlparser/src/nsHTMLTokens.cpp
+++ b/parser/htmlparser/src/nsHTMLTokens.cpp
@@ -1469,7 +1469,7 @@ void CAttributeToken::SanitizeKey() {
// legal part
if (iter != --end) {
nsAutoString str;
- CopyUnicodeTo(begin, iter, str);
+ CopyUnicodeTo(begin, ++iter, str);
mTextKey.Rebind(str);
}
}