aboutsummaryrefslogtreecommitdiffstats
path: root/builtin/receive-pack.c
diff options
context:
space:
mode:
authorJeff King <peff@peff.net>2023-04-14 17:25:20 -0400
committerJunio C Hamano <gitster@pobox.com>2023-04-14 15:08:13 -0700
commit7ce4c8f752bc0da682acbda6457d6543ad5d0069 (patch)
tree545d1046f411277a392118d3520c8385970a0765 /builtin/receive-pack.c
parentt5512: test "ls-remote --heads --symref" filtering with v0 and v2 (diff)
downloadgit-7ce4c8f752bc0da682acbda6457d6543ad5d0069.tar.gz
git-7ce4c8f752bc0da682acbda6457d6543ad5d0069.zip
v0 protocol: use size_t for capability length/offset
When parsing server capabilities, we use "int" to store lengths and offsets. At first glance this seems like a spot where our parser may be confused by integer overflow if somebody sent us a malicious response. In practice these strings are all bounded by the 64k limit of a pkt-line, so using "int" is OK. However, it makes the code simpler to audit if they just use size_t everywhere. Note that because we take these parameters as pointers, this also forces many callers to update their declared types. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/receive-pack.c')
-rw-r--r--builtin/receive-pack.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/builtin/receive-pack.c b/builtin/receive-pack.c
index 9109552533..3b495ecc84 100644
--- a/builtin/receive-pack.c
+++ b/builtin/receive-pack.c
@@ -2093,7 +2093,7 @@ static struct command *read_head_info(struct packet_reader *reader,
const char *feature_list = reader->line + linelen + 1;
const char *hash = NULL;
const char *client_sid;
- int len = 0;
+ size_t len = 0;
if (parse_feature_request(feature_list, "report-status"))
report_status = 1;
if (parse_feature_request(feature_list, "report-status-v2"))