Skip to contentSkip to conversation

Staging: vt6655: memory corruption in check in

PATCH New Dan Carpenter 1 participant 1 message Oct 18, 2011

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Staging: vt6655: memory corruption in check in

The original code left it up to the user to decide how much data to copy, but that doesn't work with a fixed size array.

drivers/staging/vt6655/wpactl.c +3 -1
index a0f994e..732ba88 100644
@@ -213,7 +213,9 @@ int wpa_set_wpadev(PSDevice pDevice, int val)
 	int uu, ii;
 
 
-	if (param->u.wpa_key.alg_name > WPA_ALG_CCMP)
+	if (param->u.wpa_key.alg_name > WPA_ALG_CCMP ||
+			param->u.wpa_key.key_len >= MAX_KEY_LEN ||
+			param->u.wpa_key.seq_len >= MAX_KEY_LEN)
 		return -EINVAL;
 
     DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "param->u.wpa_key.alg_name = %d \n", param->u.wpa_key.alg_name);