PATCH: ctdb: buffer write beyond limits

Volker Lendecke Volker.Lendecke at SerNet.DE
Mon Feb 18 16:49:14 UTC 2019


On Mon, Feb 18, 2019 at 08:19:52AM +0100, swen via samba-technical wrote:
>  data_read:
> -	num_ready = MIN(num_ready, queue->buffer.size - queue->buffer.length);
> +	num_ready = MIN(num_ready,
> +			queue->buffer.size -
> +				(queue->buffer.length + queue->buffer.offset));

Whenever I see buffer calculations without explicit overflow checks
I'm scared. So either add a very explicit comment explaining in 100%
simple words that the addition can never overflow and the subtraction
can never underflow or add the appropriate over/undeflow checks.

Thanks, Volker

-- 
SerNet GmbH, Bahnhofsallee 1b, 37081 Göttingen
phone: 0551-370000-0, mailto:kontakt at sernet.de
Gesch.F.: Dr. Johannes Loxen und Reinhild Jung
AG Göttingen: HR-B 2816 - http://www.sernet.de



More information about the samba-technical mailing list