Skip to contentSkip to conversation

Staging: vt6655-6: check keysize before memcpy()

PATCH New Dan Carpenter 1 participant 1 message Mar 29, 2012

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

PATCH 1/1 Staging: vt6655-6: check keysize before memcpy()

We need to check the we don't copy too much memory. This comes from a copy_from_user() in the ioctl.

drivers/staging/vt6656/key.c +3 -0
index 27bb523..ee62a06 100644
@@ -684,6 +684,9 @@ BOOL KeybSetDefaultKey(
         return (FALSE);
     }
 
+    if (uKeyLength > MAX_KEY_LEN)
+	    return false;
+
     pTable->KeyTable[MAX_KEY_TABLE-1].bInUse = TRUE;
     for (ii = 0; ii < ETH_ALEN; ii++)
         pTable->KeyTable[MAX_KEY_TABLE-1].abyBSSID[ii] = 0xFF;
drivers/staging/vt6655/key.c +3 -0
index 0ff8d7b..774b0d4 100644
@@ -655,6 +655,9 @@ bool KeybSetDefaultKey (
         return (false);
     }
 
+    if (uKeyLength > MAX_KEY_LEN)
+	    return false;
+
     pTable->KeyTable[MAX_KEY_TABLE-1].bInUse = true;
     for(ii=0;ii<ETH_ALEN;ii++)
         pTable->KeyTable[MAX_KEY_TABLE-1].abyBSSID[ii] = 0xFF;