]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
Use type cast to get rid of implicit sign extension
authorJouni Malinen <jouni.malinen@atheros.com>
Wed, 13 Apr 2011 22:27:38 +0000 (01:27 +0300)
committerJouni Malinen <j@w1.fi>
Wed, 13 Apr 2011 22:27:38 +0000 (01:27 +0300)
The size_t value here can be 64-bit and result in implicit sign
extension. In this particular case, that gets masked out by
host_to_be32(), so there is no practical difference, but it is better
to get rid of the 64-bit variable explicitly.

src/eap_peer/eap_ttls.c

index 25737803beeda10ccda70b2775b53f4ce5409beb..e8f0f38f04538937b3ff60bf22e841017ac0a6dc 100644 (file)
@@ -202,7 +202,7 @@ static u8 * eap_ttls_avp_hdr(u8 *avphdr, u32 avp_code, u32 vendor_id,
        }
 
        avp->avp_code = host_to_be32(avp_code);
-       avp->avp_length = host_to_be32((flags << 24) | (hdrlen + len));
+       avp->avp_length = host_to_be32((flags << 24) | (u32) (hdrlen + len));
 
        return avphdr + hdrlen;
 }