Subject: Re: [PATCH 1/3] prune-packed: fix a possible buffer overflow

From: Michael Haggerty <[email-masked]>
Date: Wed, 18 Dec 2013 23:44:58 +0100

On 12/17/2013 07:43 PM, Junio C Hamano wrote:
> Duy Nguyen <[email-masked]> writes:
> 
>> Why don't we take this opportunity to replace that array with a
>> strbuf? The conversion looks simple with this function.
> 
> Indeed.  Something like this, perhaps?
> [...]

Frankly, with my initial patches I was just trying to paper over the bug
with the smallest possible change.  It's nice that people are attempting
bigger improvements.

I went in a slightly different direction: I am spiking out an API for
iterating over loose object files.  It would be useful in a couple of
places.

[While doing so, I got sidetracked by the question: what happens if a
prune process deletes the "objects/XX" directory just the same moment
that another process is trying to write an object into that directory?
I think the relevant function is sha1_file.c:create_tmpfile().  It looks
like there is a nonzero but very small race window that could result in
a spurious "unable to create temporary file" error, but even then I
don't think there would be any corruption or anything.]

But don't let me stop you; the cleanups you are working on are
definitely nice and are complementary to my ideas.

Michael

-- 
Michael Haggerty
[email-masked]
http://softwareswirl.blogspot.com/