commit 18c37abb9e744da66fee2a2417d0ee132d05aed7 from: Stefan Sperling date: Wed Apr 17 16:11:34 2024 UTC ensure that a pkt-line fits into read buffers used by got-fetch-http commit - 4b652004e7b2173b05e8d4fbe97143810c3c250a commit + 18c37abb9e744da66fee2a2417d0ee132d05aed7 blob - 6532e7ac4d4578ef7bc324c4732b42b349b31ea1 blob + 4ac28d9fb06153bf6428008b8a6b9a556517e6ef --- libexec/got-fetch-http/got-fetch-http.c +++ libexec/got-fetch-http/got-fetch-http.c @@ -31,13 +31,14 @@ #include "got_version.h" +#include "got_lib_pkt.h" + #include "bufio.h" #define UPLOAD_PACK_ADV "application/x-git-upload-pack-advertisement" #define UPLOAD_PACK_REQ "application/x-git-upload-pack-request" #define UPLOAD_PACK_RES "application/x-git-upload-pack-result" -#define HTTP_BUFSIZ 4096 #define GOT_USERAGENT "got/" GOT_VERSION_STR #define MINIMUM(a, b) ((a) < (b) ? (a) : (b)) #define hasprfx(str, p) (strncasecmp(str, p, strlen(p)) == 0) @@ -356,7 +357,7 @@ static int get_refs(int https, const char *host, const char *port, const char *path) { struct bufio bio; - char buf[HTTP_BUFSIZ]; + char buf[GOT_PKT_MAX]; const char *errstr, *sufx = "/info/refs"; size_t skip, chunksz = 0; ssize_t r; @@ -430,7 +431,7 @@ upload_request(int https, const char *host, const char { struct bufio bio; const char *errstr; - char buf[HTTP_BUFSIZ]; + char buf[GOT_PKT_MAX]; ssize_t r; size_t chunksz = 0; long long t;