]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
P2P2: Reject P2P_VALIDATE_DIRA without nonce or tag
authorJouni Malinen <j@w1.fi>
Sun, 9 Feb 2025 17:02:05 +0000 (19:02 +0200)
committerJouni Malinen <j@w1.fi>
Sun, 9 Feb 2025 17:08:30 +0000 (19:08 +0200)
There is no point in trying to validate DIRA without these values being
available. Avoid using uninitialized stack buffer for such pointless
check.

Signed-off-by: Jouni Malinen <j@w1.fi>
wpa_supplicant/ctrl_iface.c

index fdf3a5d4cb31fb146f28e789ea8951ceae1c4db9..85fbbe45824d1c9fc168942162f16436496589ca 100644 (file)
@@ -6651,6 +6651,8 @@ static int p2p_ctrl_validate_dira(struct wpa_supplicant *wpa_s, char *cmd)
                pos2 += 6;
                if (hexstr2bin(pos2, nonce, sizeof(nonce)) < 0)
                        return -1;
+       } else {
+               return -1;
        }
 
        pos2 = os_strstr(pos, "tag=");
@@ -6658,6 +6660,8 @@ static int p2p_ctrl_validate_dira(struct wpa_supplicant *wpa_s, char *cmd)
                pos2 += 4;
                if (hexstr2bin(pos2, tag, sizeof(tag)) < 0)
                        return -1;
+       } else {
+               return -1;
        }
 
        return wpas_p2p_validate_dira(wpa_s, addr, 0, nonce, tag);