提交 b5041c5f 编写于 作者: N Nguyễn Thái Ngọc Duy 提交者: Junio C Hamano

Avoid writing to buffer in add_excludes_from_file_1()

In the next patch, the buffer that is being used within
add_excludes_from_file_1() comes from another function and does not
have extra space to put \n at the end.
Signed-off-by: NNguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: NJunio C Hamano <gitster@pobox.com>
上级 52030836
......@@ -229,10 +229,9 @@ static int add_excludes_from_file_1(const char *fname,
if (buf_p)
*buf_p = buf;
buf[size++] = '\n';
entry = buf;
for (i = 0; i < size; i++) {
if (buf[i] == '\n') {
for (i = 0; i <= size; i++) {
if (i == size || buf[i] == '\n') {
if (entry != buf + i && entry[0] != '#') {
buf[i - (i && buf[i-1] == '\r')] = 0;
add_exclude(entry, base, baselen, which);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册