Browse Source

tests: wpa_supplicant ctrl_iface network OOM in string parsing

Signed-off-by: Jouni Malinen <j@w1.fi>
Jouni Malinen 9 years ago
parent
commit
ccfe3e5db9
1 changed files with 13 additions and 0 deletions
  1. 13 0
      tests/hwsim/test_wpas_ctrl.py

+ 13 - 0
tests/hwsim/test_wpas_ctrl.py

@@ -231,6 +231,19 @@ def test_wpas_ctrl_network(dev):
         if "FAIL" not in dev[0].request("SET_NETWORK %d bssid_blacklist %s" % (id, val)):
             raise Exception("Invalid bssid_blacklist value accepted")
 
+def test_wpas_ctrl_network_oom(dev):
+    """wpa_supplicant ctrl_iface network OOM in string parsing"""
+    id = dev[0].add_network()
+
+    tests = [ ('"foo"', 1, 'dup_binstr;wpa_config_set'),
+              ('P"foo"', 1, 'dup_binstr;wpa_config_set'),
+              ('P"foo"', 2, 'wpa_config_set'),
+              ('112233', 1, 'wpa_config_set') ]
+    for val,count,func in tests:
+        with alloc_fail(dev[0], count, func):
+            if "FAIL" not in dev[0].request("SET_NETWORK " + str(id) + ' ssid ' + val):
+                raise Exception("Unexpected success for SET_NETWORK during OOM")
+
 def test_wpas_ctrl_many_networks(dev, apdev):
     """wpa_supplicant ctrl_iface LIST_NETWORKS with huge number of networks"""
     for i in range(1000):