summaryrefslogtreecommitdiff
path: root/strbuf.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2011-04-27 18:36:43 (GMT)
committerJunio C Hamano <gitster@pobox.com>2011-04-27 18:36:43 (GMT)
commitc5a5f12e5a514d198f49a76d4e001c88570bf7d1 (patch)
treeb66c2a8a2596b27f922fd2b9aa476895037a8780 /strbuf.c
parent2a2dbd2770b4dbda59b5b22e19fac973d08d0864 (diff)
parente96c19c50fb0807570b85cb5b8aae6dfcfa9b9ec (diff)
downloadgit-c5a5f12e5a514d198f49a76d4e001c88570bf7d1.zip
git-c5a5f12e5a514d198f49a76d4e001c88570bf7d1.tar.gz
git-c5a5f12e5a514d198f49a76d4e001c88570bf7d1.tar.bz2
Merge branch 'ef/maint-strbuf-init'
* ef/maint-strbuf-init: config: support values longer than 1023 bytes strbuf: make sure buffer is zero-terminated
Diffstat (limited to 'strbuf.c')
-rw-r--r--strbuf.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/strbuf.c b/strbuf.c
index 77444a9..09c43ae 100644
--- a/strbuf.c
+++ b/strbuf.c
@@ -30,8 +30,10 @@ void strbuf_init(struct strbuf *sb, size_t hint)
{
sb->alloc = sb->len = 0;
sb->buf = strbuf_slopbuf;
- if (hint)
+ if (hint) {
strbuf_grow(sb, hint);
+ sb->buf[0] = '\0';
+ }
}
void strbuf_release(struct strbuf *sb)