Commit e7d0ced2 by Russell Belfer

Fix longstanding valgrind warning

There was a possible circumstance that could result in reading
past the end of a buffer.  This check fixes that.
parent 29e92d38
...@@ -87,7 +87,7 @@ int git_buf_text_crlf_to_lf(git_buf *tgt, const git_buf *src) ...@@ -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 */ /* Do not drop \r unless it is followed by \n */
if (next[1] != '\n') if (next + 1 == scan_end || next[1] != '\n')
*out++ = '\r'; *out++ = '\r';
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment