[PATCH v2 1/2] tftp: fix off by one error

Denys Vlasenko vda.linux at googlemail.com
Wed Sep 3 15:22:56 UTC 2014


On Mon, Sep 1, 2014 at 10:24 PM, Aaro Koskinen <aaro.koskinen at iki.fi> wrote:
> RFC 2347 allows requests to be up to 512 bytes, so a request equal
> to sizeof(G.block_buf) should be fine.
>
> The remaining result > sizeof(G.block_buf) check would be redudant,
> since the recv function should take care of not overrunning the buffer,
> so delete that too.

If result == sizeof(G.block_buf), then we potentially had a short read.
We should not use such data.

You are right that "result > sizeof(G.block_buf)" should be impossible,
that's just a bit of paranoia.


More information about the busybox mailing list