From: Michael Haggerty Date: Wed, 18 Dec 2013 22:44:58 GMT Subject: Re: [PATCH 1/3] prune-packed: fix a possible buffer overflow Message-ID: <52B2256A.3060802@alum.mit.edu> In-Reply-To: On 12/17/2013 07:43 PM, Junio C Hamano wrote: > Duy Nguyen 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 mhagger@alum.mit.edu http://softwareswirl.blogspot.com/