From: Stephen Boyd Date: Fri, 27 Mar 2009 04:31:05 GMT Subject: Re: [PATCH] log-tree: fix patch filename computation in "git format-patch" Message-ID: <780e0a6b0903262131l26e9ea6ua3289925fd322d93@mail.gmail.com> In-Reply-To: <7v3acziot0.fsf@gitster.siamese.dyndns.org> On Thu, Mar 26, 2009 at 9:15 PM, Junio C Hamano wrote: > > Shouldn't it be just: > >        size_t max_len = start_len + FORMAT_PATCH_NAME_MAX - suffix_len; >        if (max_len < buf->len) >                strbuf_setlen(buf, max_len); >        strbuf_addstr(buf, suffix); Yes, this is good. > > The caller must make sure that suffix_len is sufficiently shorter than > FORMAT_PATCH_NAME_MAX; I do not know if the current code does that, > though. > The original code never did this. What should happen in this case? I am away on travel this week, so I won't be able to update this until Monday. Thanks, Stephen