Re: [PATCH v7 2/2] http-backend: respect CONTENT_LENGTH for receive-pack
- From
Ramsay Jones <ramsay@ramsayjones.plus.com>
- Date
- Jun 5, 2018, 02:30 UTC
- Message-ID
- <ff9215cb-6f38-90df-3073-c0592751249d@ramsayjones.plus.com>
- In-Reply-To
- <20180604170640.GB27650@jessie.local>
On 04/06/18 18:06, Max Kirillov wrote:
Show 8 quoted lines
> On Mon, Jun 04, 2018 at 01:31:58PM +0900, Junio C Hamano wrote:
>> Max Kirillov <max@max630.net> writes:
>>> + size_t n = xread(0, buf, chunk_length);
>>> + if (n < 0)
>>> + die_errno("Reading request failed");
>>
>> n that is of type size_t is unsigned and cannot be negative here.
> Hmm, xread() returns an ssize_t, which is a signed type ...
> Thanks, fixing it > Do you think sanity check for n <= chunk_length (the code > will go mad in this case) is needed? As far as I can see n > returns straight from system's read()
ATB, Ramsay Jones