]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
Use explicit type casting to avoid sign extensions
authorJouni Malinen <j@w1.fi>
Sun, 4 Dec 2011 15:06:35 +0000 (17:06 +0200)
committerJouni Malinen <j@w1.fi>
Sun, 4 Dec 2011 15:06:35 +0000 (17:06 +0200)
Make sure sign extension does not end up getting used here by
explicitly type casting the variables to correct size.

Signed-hostap: Jouni Malinen <j@w1.fi>

src/eap_server/eap_server_ttls.c

index c98e539779574f8f70f6c9e4b9a91d45bcb4cf0a..398d0f16f6b924fad9c4df6c3b3c1b2aba49489a 100644 (file)
@@ -98,7 +98,8 @@ 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(((u32) flags << 24) |
+                                      ((u32) (hdrlen + len)));
 
        return avphdr + hdrlen;
 }