summaryrefslogtreecommitdiff
path: root/xpcom
diff options
context:
space:
mode:
authorStephen A Pohl <spohl.mozilla.bugs@gmail.com>2022-05-04 13:54:20 +0000
committerMoonchild <moonchild@palemoon.org>2022-05-04 13:54:20 +0000
commitd01ae5cf25433bef452c8b9ff0aa0ae796b966a0 (patch)
tree734751b16f53ff4f7104ba34eb09941e757f84a8 /xpcom
parent92b3def6a88f9ea15c9e51e22a57b667edea29c0 (diff)
downloaduxp-d01ae5cf25433bef452c8b9ff0aa0ae796b966a0.tar.gz
[XPCOM] Improve the conversion of line breaks.
Fix an off-by-one error in CRLF checking.
Diffstat (limited to 'xpcom')
-rw-r--r--xpcom/io/nsLinebreakConverter.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/xpcom/io/nsLinebreakConverter.cpp b/xpcom/io/nsLinebreakConverter.cpp
index 62bcb54e23..a7c99d3f16 100644
--- a/xpcom/io/nsLinebreakConverter.cpp
+++ b/xpcom/io/nsLinebreakConverter.cpp
@@ -217,7 +217,7 @@ ConvertUnknownBreaks(const T* aInSrc, int32_t& aIoLen, const char* aDestBreak)
while (src < srcEnd) {
if (*src == nsCRT::CR) {
- if (src < srcEnd && src[1] == nsCRT::LF) {
+ if (src + 1< srcEnd && src[1] == nsCRT::LF) {
// CRLF
finalLen += destBreakLen;
src++;
@@ -246,7 +246,7 @@ ConvertUnknownBreaks(const T* aInSrc, int32_t& aIoLen, const char* aDestBreak)
while (src < srcEnd) {
if (*src == nsCRT::CR) {
- if (src < srcEnd && src[1] == nsCRT::LF) {
+ if (src + 1 < srcEnd && src[1] == nsCRT::LF) {
// CRLF
AppendLinebreak(dst, aDestBreak);
src++;