]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
WPS: Check sha256_vector() result in wps_build_oob_dev_pw()
authorJouni Malinen <jouni@qca.qualcomm.com>
Mon, 16 May 2016 18:06:44 +0000 (21:06 +0300)
committerJouni Malinen <j@w1.fi>
Mon, 16 May 2016 18:06:44 +0000 (21:06 +0300)
This gets rid of a valgrind warning on uninitialized memory read in the
wpas_ctrl_error test case where the result was used after the failed
sha256_vector() call.

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

index 2efc27ec46a2225e00965ee86b2fbcf5a7239aa2..770f5e90cbde0edba1d719508adaf1d80ddc04fc 100644 (file)
@@ -413,7 +413,8 @@ int wps_build_oob_dev_pw(struct wpabuf *msg, u16 dev_pw_id,
                   dev_pw_id);
        addr[0] = wpabuf_head(pubkey);
        hash_len = wpabuf_len(pubkey);
-       sha256_vector(1, addr, &hash_len, pubkey_hash);
+       if (sha256_vector(1, addr, &hash_len, pubkey_hash) < 0)
+               return -1;
 #ifdef CONFIG_WPS_TESTING
        if (wps_corrupt_pkhash) {
                wpa_hexdump(MSG_DEBUG, "WPS: Real Public Key Hash",