Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2007-09-27 10:34:01 +0400
committerJunio C Hamano <gitster@pobox.com>2007-09-27 10:34:01 +0400
commitb4833a2c62578bdbfd300e296702214cb1b9a601 (patch)
tree89268d44aea3a16ec57d6a4aa860ef517af65095
parent1dffb8fa8056860e769f3a0c6e232d436f5a5c17 (diff)
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>
-rw-r--r--builtin-rerere.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/builtin-rerere.c b/builtin-rerere.c
index d331772e10..b8206744c1 100644
--- a/builtin-rerere.c
+++ b/builtin-rerere.c
@@ -113,8 +113,10 @@ static int handle_file(const char *path,
fputs(">>>>>>>\n", out);
}
if (sha1) {
- SHA1_Update(&ctx, one.buf, one.len + 1);
- SHA1_Update(&ctx, two.buf, two.len + 1);
+ SHA1_Update(&ctx, one.buf ? one.buf : "",
+ one.len + 1);
+ SHA1_Update(&ctx, two.buf ? two.buf : "",
+ two.len + 1);
}
strbuf_reset(&one);
strbuf_reset(&two);