diff options
author | Jeff King <peff@peff.net> | 2023-04-15 00:25:20 +0300 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2023-04-15 01:08:13 +0300 |
commit | 7ce4c8f752bc0da682acbda6457d6543ad5d0069 (patch) | |
tree | 545d1046f411277a392118d3520c8385970a0765 /transport.c | |
parent | c4716236f218cd1278bde43ed2e6773f1d2e667a (diff) |
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 'transport.c')
-rw-r--r-- | transport.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/transport.c b/transport.c index 89a220425e..6223dc3de2 100644 --- a/transport.c +++ b/transport.c @@ -317,7 +317,7 @@ static struct ref *handshake(struct transport *transport, int for_push, struct git_transport_data *data = transport->data; struct ref *refs = NULL; struct packet_reader reader; - int sid_len; + size_t sid_len; const char *server_sid; connect_setup(transport, for_push); |