potential bug in atomicio?

Matt Johnston matt at ucc.asn.au
Tue Jul 17 20:34:16 AWST 2018


On Wed, Jul 11, 2018 at 05:26:17PM -0300, Daniel Gutson wrote:
> Hi,
> 
>    considering this:
> 
> https://github.com/mkj/dropbear/blob/d740dc548924f2faf0934e5f9a4b83d2b5d6902d/atomicio.c#L55
...
> What if res is negative less than -1, for example -2 ? Shouldn't be a check
> there that res is > 0 ?

Hi Daniel,

atomicio() is always to be called with f == read or f == write which both
won't return a value <-1. Have you found a platform that doesn't do that?
I'd probably write it as "ret < 0" myself but it was a
straight copy from OpenSSH's tree.

Cheers,
Matt


More information about the Dropbear mailing list