diff options
author | Junio C Hamano <gitster@pobox.com> | 2011-05-23 10:27:42 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2011-05-23 10:27:42 -0700 |
commit | 34ad5a52b44d1b95f3b8833c02a0920f3454755b (patch) | |
tree | 633ed4e6b0d487b4b65202b9fcfbe6e4670b0785 /diff.c | |
parent | c3c7797e1d151417333296ab3720614c1e235094 (diff) | |
parent | 42536dd9b9829b4eb4e3706e141b3c8bffa3e826 (diff) | |
download | git-34ad5a52b44d1b95f3b8833c02a0920f3454755b.tar.gz |
Merge branch 'jm/maint-diff-words-with-sbe'
* jm/maint-diff-words-with-sbe:
do not read beyond end of malloc'd buffer
Diffstat (limited to 'diff.c')
-rw-r--r-- | diff.c | 12 |
1 files changed, 10 insertions, 2 deletions
@@ -1117,8 +1117,16 @@ static void fn_out_consume(void *priv, char *line, unsigned long len) emit_line(ecbdata->opt, plain, reset, line, len); fputs("~\n", ecbdata->opt->file); } else { - /* don't print the prefix character */ - emit_line(ecbdata->opt, plain, reset, line+1, len-1); + /* + * Skip the prefix character, if any. With + * diff_suppress_blank_empty, there may be + * none. + */ + if (line[0] != '\n') { + line++; + len--; + } + emit_line(ecbdata->opt, plain, reset, line, len); } return; } |