Date: Thu, 25 Mar 2021 12:21:52 +0100 From: Gert Doering Message-ID: <20210325112152.GM976@...1296...> References: <20210324222330.455-1-arne@...1227...> <20210324222330.455-2-arne@...1227...> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="2xcpa89S5zuNdo/i" Content-Disposition: inline In-Reply-To: <20210324222330.455-2-arne@...1227...> Subject: Re: [Openvpn-devel] [PATCH 2/4] Fix unchecked signess conversions reported by MSVC List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Arne Schwabe Cc: openvpn-devel@lists.sourceforge.net --2xcpa89S5zuNdo/i Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Hi, On Wed, Mar 24, 2021 at 11:23:28PM +0100, Arne Schwabe wrote: > diff --git a/src/openvpn/dhcp.c b/src/openvpn/dhcp.c > index c19370eb..1e79ccc4 100644 > --- a/src/openvpn/dhcp.c > +++ b/src/openvpn/dhcp.c > @@ -113,7 +113,7 @@ do_extract(struct dhcp *dhcp, int optlen) > const int owlen =3D len + 2; /* len of da= ta to overwrite */ > uint8_t *src =3D dest + owlen; > uint8_t *end =3D p + optlen; > - const int movlen =3D end - src; > + const size_t movlen =3D end - src; > if (movlen > 0) This code scares me... I think it is correct because of all these checks around, but I like the version with a signed int really more "should all these assumptions about i