rerere: Fix use of an empty strbuf.buf
The code incorrectly assumed that strbuf.buf is always an allocated piece of memory that has NUL at offset strbuf.len. That assumption does not hold for a freshly initialized empty strbuf. Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
parent
1dffb8fa80
commit
b4833a2c62
@ -113,8 +113,10 @@ static int handle_file(const char *path,
|
|||||||
fputs(">>>>>>>\n", out);
|
fputs(">>>>>>>\n", out);
|
||||||
}
|
}
|
||||||
if (sha1) {
|
if (sha1) {
|
||||||
SHA1_Update(&ctx, one.buf, one.len + 1);
|
SHA1_Update(&ctx, one.buf ? one.buf : "",
|
||||||
SHA1_Update(&ctx, two.buf, two.len + 1);
|
one.len + 1);
|
||||||
|
SHA1_Update(&ctx, two.buf ? two.buf : "",
|
||||||
|
two.len + 1);
|
||||||
}
|
}
|
||||||
strbuf_reset(&one);
|
strbuf_reset(&one);
|
||||||
strbuf_reset(&two);
|
strbuf_reset(&two);
|
||||||
|
Loading…
Reference in New Issue
Block a user