Commit 24cce2398f893b77f183425fffd957daa3300c5a

Vicent Marti 2014-11-21T18:09:57

text: Null-terminate a string if we've been gouging it

1
2
3
4
5
6
7
8
9
10
11
12
diff --git a/src/buf_text.c b/src/buf_text.c
index 8d2b141..cead599 100644
--- a/src/buf_text.c
+++ b/src/buf_text.c
@@ -143,6 +143,7 @@ int git_buf_text_lf_to_crlf(git_buf *tgt, const git_buf *src)
 		tgt->ptr[tgt->size++] = '\n';
 	}
 
+	tgt->ptr[tgt->size] = '\0';
 	return git_buf_put(tgt, scan, end - scan);
 }