]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
Check hmac_md5() result in radius_msg_verify_msg_auth()
authorJouni Malinen <jouni@qca.qualcomm.com>
Mon, 16 May 2016 17:06:46 +0000 (20:06 +0300)
committerJouni Malinen <j@w1.fi>
Mon, 16 May 2016 17:07:58 +0000 (20:07 +0300)
This gets rid of a valgrind warning on uninitialized memory read in the
hostapd_oom_wpa2_eap_connect test case where memcmp is used after failed
hmac_md5() call.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
src/radius/radius.c

index 97c8de0144d82d8d9e8c1b14911b0eda2a9d7c49..67cb92fac975a4db668a42d1a1ddc1dd37fdb626 100644 (file)
@@ -818,8 +818,9 @@ int radius_msg_verify_msg_auth(struct radius_msg *msg, const u8 *secret,
                os_memcpy(msg->hdr->authenticator, req_auth,
                          sizeof(msg->hdr->authenticator));
        }
-       hmac_md5(secret, secret_len, wpabuf_head(msg->buf),
-                wpabuf_len(msg->buf), auth);
+       if (hmac_md5(secret, secret_len, wpabuf_head(msg->buf),
+                    wpabuf_len(msg->buf), auth) < 0)
+               return 1;
        os_memcpy(attr + 1, orig, MD5_MAC_LEN);
        if (req_auth) {
                os_memcpy(msg->hdr->authenticator, orig_authenticator,