Web lists-archives.com

Re: [PATCH v7 2/2] http-backend: respect CONTENT_LENGTH for receive-pack




Max Kirillov <max@xxxxxxxxxx> writes:

> +static void pipe_fixed_length(const char *prog_name, int out, size_t req_len)
> +{
> +	unsigned char buf[8192];
> +	size_t remaining_len = req_len;
> +
> +	while (remaining_len > 0) {
> +		size_t chunk_length = remaining_len > sizeof(buf) ? sizeof(buf) : remaining_len;
> +		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.