summaryrefslogtreecommitdiff
path: root/http.h
diff options
context:
space:
mode:
authorJeff King <peff@peff.net>2018-05-19 01:56:37 (GMT)
committerJunio C Hamano <gitster@pobox.com>2018-05-21 00:54:30 (GMT)
commit390c6cbc5e643b6d89869b319b51b5b62a3f5a09 (patch)
tree76314ecfefce389a63c4950b731d4ada8325d28f /http.h
parent468165c1d8a442994a825f3684528361727cd8c0 (diff)
downloadgit-390c6cbc5e643b6d89869b319b51b5b62a3f5a09.zip
git-390c6cbc5e643b6d89869b319b51b5b62a3f5a09.tar.gz
git-390c6cbc5e643b6d89869b319b51b5b62a3f5a09.tar.bz2
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 <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'http.h')
-rw-r--r--http.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/http.h b/http.h
index f7bd3b2..d9379f9 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];