From 390c6cbc5e643b6d89869b319b51b5b62a3f5a09 Mon Sep 17 00:00:00 2001 From: Jeff King Date: Fri, 18 May 2018 18:56:37 -0700 Subject: http: use strbufs instead of fixed buffers We keep the names of incoming packs and objects in fixed PATH_MAX-size buffers, and snprintf() into them. This is unlikely to end up with truncated filenames, but it is possible (especially on systems where PATH_MAX is shorter than actual paths can be). Let's switch to using strbufs, which makes the question go away entirely. Signed-off-by: Jeff King Signed-off-by: Junio C Hamano --- http.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'http.h') diff --git a/http.h b/http.h index f7bd3b26b0..d9379f9cb2 100644 --- a/http.h +++ b/http.h @@ -200,7 +200,7 @@ struct http_pack_request { struct packed_git *target; struct packed_git **lst; FILE *packfile; - char tmpfile[PATH_MAX]; + struct strbuf tmpfile; struct active_request_slot *slot; }; @@ -212,7 +212,7 @@ extern void release_http_pack_request(struct http_pack_request *preq); /* Helpers for fetching object */ struct http_object_request { char *url; - char tmpfile[PATH_MAX]; + struct strbuf tmpfile; int localfile; CURLcode curl_result; char errorstr[CURL_ERROR_SIZE]; -- cgit v1.2.1