From: Jeff King Date: Thu, 24 Sep 2015 21:06:55 +0000 (-0400) Subject: add_packed_git: convert strcpy into xsnprintf X-Git-Tag: v2.8.3~32^2~4 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/48bcc1c3cc09db1a6da0ce47460fae6e5f7edd4b?ds=inline;hp=48bcc1c3cc09db1a6da0ce47460fae6e5f7edd4b add_packed_git: convert strcpy into xsnprintf We have the path "foo.idx", and we create a buffer big enough to hold "foo.pack" and "foo.keep", and then strcpy straight into it. This isn't a bug (we have enough space), but it's very hard to tell from the strcpy that this is so. Let's instead use strip_suffix to take off the ".idx", record the size of our allocation, and use xsnprintf to make sure we don't violate our assumptions. Signed-off-by: Jeff King Signed-off-by: Junio C Hamano ---