tests: Validate parsing and rejection of invalid WFD subelement

This is a regression test for wifi_display_subelem_hex() bounds checking
issue.

Signed-off-by: Jouni Malinen <j@w1.fi>
This commit is contained in:
Jouni Malinen 2014-06-13 15:29:48 +03:00
parent 49d13df63c
commit e862968d18

View file

@ -229,3 +229,24 @@ def test_wifi_display_persistent_group(dev):
dev[0].request("SET wifi_display 0")
dev[1].request("SET wifi_display 0")
dev[2].request("SET wifi_display 0")
def test_wifi_display_invalid_subelem(dev):
"""Wi-Fi Display and invalid subelement parsing"""
addr1 = dev[1].p2p_dev_addr()
try:
enable_wifi_display(dev[0])
enable_wifi_display(dev[1])
dev[1].request("WFD_SUBELEM_SET 0 ffff00411c440028")
dev[1].p2p_listen()
dev[0].p2p_find(social=True)
ev = dev[0].wait_global_event(["P2P-DEVICE-FOUND"], timeout=10)
if ev is None:
raise Exception("Device discovery timed out")
if "wfd_dev_info=" in ev:
raise Exception("Invalid WFD subelement was shown")
finally:
dev[0].request("SET wifi_display 0")
dev[1].request("SET wifi_display 0")