driver_test: Check set_ssid len before trying to hexdump the SSID
authorJouni Malinen <jouni.malinen@atheros.com>
Thu, 14 Apr 2011 16:52:26 +0000 (19:52 +0300)
committerJouni Malinen <j@w1.fi>
Thu, 14 Apr 2011 16:52:26 +0000 (19:52 +0300)
src/drivers/driver_test.c

index 9e502e4..6bfa46d 100644 (file)
@@ -1114,9 +1114,11 @@ static int test_driver_set_ssid(void *priv, const u8 *buf, int len)
        struct test_driver_bss *bss = priv;
 
        wpa_printf(MSG_DEBUG, "%s(ifname=%s)", __func__, bss->ifname);
+       if (len < 0)
+               return -1;
        wpa_hexdump_ascii(MSG_DEBUG, "test_driver_set_ssid: SSID", buf, len);
 
-       if (len < 0 || (size_t) len > sizeof(bss->ssid))
+       if ((size_t) len > sizeof(bss->ssid))
                return -1;
 
        os_memcpy(bss->ssid, buf, len);