From: Junio C Hamano Date: Thu, 27 Sep 2007 06:34:01 +0000 (-0700) Subject: rerere: Fix use of an empty strbuf.buf X-Git-Tag: v1.5.4-rc0~387^2~6 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=b4833a2c62578bdbfd300e296702214cb1b9a601;p=git.git 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 --- diff --git a/builtin-rerere.c b/builtin-rerere.c index d331772e1..b8206744c 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);