]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
EAP-TTLS: Avoid ubsan warning on 0x80<<24 not fitting in int
authorJouni Malinen <j@w1.fi>
Tue, 7 Jul 2015 12:41:51 +0000 (15:41 +0300)
committerJouni Malinen <j@w1.fi>
Tue, 7 Jul 2015 13:25:06 +0000 (16:25 +0300)
Use a typecast to make this unsigned so that the MSB fits within the
range of allowed values.

Signed-off-by: Jouni Malinen <j@w1.fi>
src/eap_peer/eap_ttls.c

index 25e3cbab021e13744817ffd862c734cc94c6bf68..189a6f1a9fd53981cfd931bebe31f5fe5de1ba55 100644 (file)
@@ -175,7 +175,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) | (u32) (hdrlen + len));
+       avp->avp_length = host_to_be32(((u32) flags << 24) |
+                                      (u32) (hdrlen + len));
 
        return avphdr + hdrlen;
 }