Andrew's git
/
gitweb.git
/ diff
summary
|
log
|
commit
| diff |
tree
commit
grep
author
committer
pickaxe
?
re
rerere: Fix use of an empty strbuf.buf
author
Junio C Hamano
<gitster@pobox.com>
Thu, 27 Sep 2007 06:34:01 +0000
(23:34 -0700)
committer
Junio C Hamano
<gitster@pobox.com>
Thu, 27 Sep 2007 06:34:01 +0000
(23:34 -0700)
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>
builtin-rerere.c
patch
|
blob
|
history
raw
|
patch
| inline |
side by side
(parent:
1dffb8f
)
diff --git
a/builtin-rerere.c
b/builtin-rerere.c
index d331772e100d87592d091aa5ad9c38d36bea86c2..b8206744c12307b3efbdebc99e5bcdd4a8632212 100644
(file)
--- 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);