author | Junio C Hamano <gitster@pobox.com> | |
Tue, 12 Jan 2010 20:09:54 +0000 (12:09 -0800) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Wed, 13 Jan 2010 20:12:52 +0000 (12:12 -0800) | ||
commit | 81d2caefedefa40557baf7af846580f35de3f995 | |
tree | 983d8109d02eaf781cab0c8cf6b69e270b5b2067 | tree | snapshot |
parent | 902f235378cb2b2f6dd5dd664b9630c95321f0ae | commit | diff |
strbuf_addbuf(): allow passing the same buf to dst and src
If sb and sb2 are the same (i.e. doubling the string), the underlying
strbuf_add() can make sb2->buf invalid by calling strbuf_grow(sb) at
the beginning; if realloc(3) done by strbuf_grow() needs to move the
string, strbuf_add() will read from an already freed buffer.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
If sb and sb2 are the same (i.e. doubling the string), the underlying
strbuf_add() can make sb2->buf invalid by calling strbuf_grow(sb) at
the beginning; if realloc(3) done by strbuf_grow() needs to move the
string, strbuf_add() will read from an already freed buffer.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
strbuf.h | diff | blob | history |