From: Max Kirillov Date: Sun, 26 Nov 2017 00:43:00 GMT Subject: Re: [PATCH] http-backend: respect CONTENT_LENGTH as specified by rfc3875 Message-ID: <20171126004300.GB26158@jessie.local> In-Reply-To: On Sat, Nov 25, 2017 at 07:38:33PM -0500, Eric Sunshine wrote: > On Sat, Nov 25, 2017 at 4:47 PM, Max Kirillov wrote: >> On Thu, Nov 23, 2017 at 08:30:39PM -0500, Eric Sunshine wrote: >>>> +static ssize_t read_request_fix_len(int fd, size_t req_len, unsigned char **out) >>> >>> Wrong data type: s/size_t req_len/ssize_t req_len/ >> >> Passing negative value to the function makes no sense. I >> could add explicit type cast to make it clear. It should be >> safe as site_t's range is bigger, and overflown >> CONTENT_LENGTH results in die() at parsing (I have a test >> which verifies it) > > A concern with requesting size_t bytes is that, if it does read all > bytes, that value can't necessarily be represented by the ssize_t > returned from the function. Where would the cast be placed that you > suggest? How do other git functions deal with this sort of situation? Right... ok, let it be ssize_t