summaryrefslogtreecommitdiff
path: root/src/buf_text.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/buf_text.c')
-rw-r--r--src/buf_text.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/buf_text.c b/src/buf_text.c
index eda86adb3..631feb3f8 100644
--- a/src/buf_text.c
+++ b/src/buf_text.c
@@ -87,7 +87,7 @@ int git_buf_text_crlf_to_lf(git_buf *tgt, const git_buf *src)
}
/* Do not drop \r unless it is followed by \n */
- if (next[1] != '\n')
+ if (next + 1 == scan_end || next[1] != '\n')
*out++ = '\r';
}