]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
EAP-FAST: Make PAC file A_ID parser easier to analyze
authorJouni Malinen <j@w1.fi>
Sun, 23 Nov 2014 18:36:17 +0000 (20:36 +0200)
committerJouni Malinen <j@w1.fi>
Sun, 23 Nov 2014 19:03:40 +0000 (21:03 +0200)
Some static analyzers seem to have issues with "pos + len > end"
validation (CID 62875), so convert this to "len > end - pos" to make it
more obvious that len is validated against its bounds.

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

index 377080f834971b7d2fb0b52e9eb3c49f948d13fe..32da82ce8871f5732664d1dc77f223b953354a38 100644 (file)
@@ -714,7 +714,7 @@ static void eap_fast_pac_get_a_id(struct eap_fast_pac *pac)
                pos += 2;
                len = WPA_GET_BE16(pos);
                pos += 2;
-               if (pos + len > end)
+               if (len > (unsigned int) (end - pos))
                        break;
 
                if (type == PAC_TYPE_A_ID) {