From: Jeff King Date: Thu, 24 Sep 2015 21:07:49 +0000 (-0400) Subject: write_loose_object: convert to strbuf X-Git-Tag: v2.7.0-rc0~87^2~21 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/d4b3d11a03c5733a37656ca2f23171be6efad7d3?hp=d4b3d11a03c5733a37656ca2f23171be6efad7d3 write_loose_object: convert to strbuf When creating a loose object tempfile, we use a fixed PATH_MAX-sized buffer, and strcpy directly into it. This isn't buggy, because we do a rough check of the size, but there's no verification that our guesstimate of the required space is enough (in fact, it's several bytes too big for the current naming scheme). Let's switch to a strbuf, which makes this much easier to verify. The allocation overhead should be negligible, since we are replacing a static buffer with a static strbuf, and we'll only need to allocate on the first call. While we're here, we can also document a subtle interaction with mkstemp that would be easy to overlook. Signed-off-by: Jeff King Signed-off-by: Junio C Hamano ---