diff options
| author | Russell Belfer <rb@github.com> | 2013-09-11 12:38:06 -0700 |
|---|---|---|
| committer | Russell Belfer <rb@github.com> | 2013-09-17 09:31:44 -0700 |
| commit | e7d0ced2192c5efeea6d9f5667d366891010b86a (patch) | |
| tree | f31ceb04935e01ccb3ee994424d9c61b80e53634 /src/buf_text.c | |
| parent | 29e92d385e0bb43d45ddea5f8173d78fcceac3a6 (diff) | |
| download | libgit2-e7d0ced2192c5efeea6d9f5667d366891010b86a.tar.gz | |
Fix longstanding valgrind warning
There was a possible circumstance that could result in reading
past the end of a buffer. This check fixes that.
Diffstat (limited to 'src/buf_text.c')
| -rw-r--r-- | src/buf_text.c | 2 |
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'; } |
