On Sun, Apr 10, 2011 at 10:57 PM, Jeff King <peff@xxxxxxxx> wrote: > On Sun, Apr 10, 2011 at 10:54:17PM +0200, Erik Faye-Lund wrote: > >> strbuf_init does not zero-terminate the initial buffer when hint is >> non-zero. Fix this so strbuf_attach does not return garbage. > > s/attach/detach/ I think. Indeed, thanks for catching it. > It is more than just detach, though; the > NUL-termination is supposed to be an invariant of strbuf, so any code > just looking at "sb.buf" would be broken. So your code looks fine, but > you may want to mention that in the commit message. > You're right. How about something like this instead? strbuf_init does not zero-terminate the initial buffer when hint is non-zero. Fix this so we can rely on the string to be zero-terminated even if we haven't filled it with anything yet. -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html