threads / discuss / 42929

Re: LARGE_PACKET_MAX wrong?

Subject: Re: LARGE_PACKET_MAX wrong?

## tl;dr

One message between Jul 26, 2016 and Jul 26, 2016.

replies: 0people: 1as markdown or json

Jeff King· Jul 26, 2016, 13:42 UTC · lore
On Tue, Jul 26, 2016 at 03:07:41PM +0200, Lars Schneider wrote:
Show 12 quoted lines
> I am reading the pkt-line code and stumbled across this oddity:
> 
> LARGE_PACKET_MAX is defined as 65520
> https://github.com/git/git/blob/8c6d1f9807c67532e7fb545a944b064faff0f70b/pkt-line.h#L79
> 
> In `format_packet` we check that the 4 bytes of length data plus payload is not larger than LARGE_PACKET_MAX (= 65520)
> https://github.com/git/git/blob/8c6d1f9807c67532e7fb545a944b064faff0f70b/pkt-line.c#L111-L112
> 
> However, in the documentation we state that 4 bytes of length data plus payload must not exceed 65524
> https://github.com/git/git/blob/8c6d1f9807c67532e7fb545a944b064faff0f70b/Documentation/technical/protocol-common.txt#L70-L72
> 
> Who is right? Code or documentation? 

I think the documentation is wrong. Git's packet_read() will complain on a 65524-byte incoming packet (it actually handles up to 65523, but that is simply a quirk of the implementation).

The sending sides always include the 4-byte header in the LARGE_PACKET_MAX calculations.

So I don't know what was intended once upon a time, but I think we have to stick to what the code does, because there are many deployed instances that we cannot break compatibility with.

-Peff

← back to recent threads