From 35530d1472416795b8d4982306895ca3f3f93fcf Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Thu, 14 Apr 2011 19:52:26 +0300 Subject: [PATCH] driver_test: Check set_ssid len before trying to hexdump the SSID --- src/drivers/driver_test.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/drivers/driver_test.c b/src/drivers/driver_test.c index 9e502e4fc..6bfa46dbc 100644 --- a/src/drivers/driver_test.c +++ b/src/drivers/driver_test.c @@ -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);