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

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

index 67cb92fac975a4db668a42d1a1ddc1dd37fdb626..defcd9274b86507f7b22600df0b040baecf8153e 100644 (file)
@@ -1018,7 +1018,10 @@ static u8 * decrypt_ms_key(const u8 *key, size_t len,
                        addr[1] = pos - MD5_MAC_LEN;
                        elen[1] = MD5_MAC_LEN;
                }
-               md5_vector(first ? 3 : 2, addr, elen, hash);
+               if (md5_vector(first ? 3 : 2, addr, elen, hash) < 0) {
+                       os_free(plain);
+                       return NULL;
+               }
                first = 0;
 
                for (i = 0; i < MD5_MAC_LEN; i++)