Subject: Re: Windows Warnings

Re: Windows Warnings

From: Peter Stuge <>
Date: Mon, 1 Jul 2019 09:23:01 +0000

Narayan Subramanian wrote:
> Most of these can be fixed using length trimming bitmasks and other such
> simple transformations.
> #define TO32BIT(X) ( (X) & UINT_MAX ) //UINT_MAX is 0xFFFFFFFF
> rc = libssh2_base64_decode(hosts->session, &ptr, &ptrlen,
> host, TO32BIT(hostlen) );
> I'm sure all warnings can be fixed by simple in - place transformations
> without changing external ABI. Let me know what you think ...

Please don't send patches to fix the warnings, please send patches to fix
the code. There is a significant difference between the two.

If you merely silence the warning by (now explicitly) truncating the
value then the value continues to be truncated. Whenever that
truncating is actually incorrect you have literally swept the warning
under the rug and have made the real problem much harder to find.

Received on 2019-07-01