[NDIS]
authorRafal Harabien <rafalh@reactos.org>
Sat, 26 Mar 2011 15:12:23 +0000 (15:12 +0000)
committerRafal Harabien <rafalh@reactos.org>
Sat, 26 Mar 2011 15:12:23 +0000 (15:12 +0000)
Correct Length value in case string is truncated

svn path=/trunk/; revision=51159

reactos/drivers/network/ndis/ndis/config.c

index b95f1e0..f0227c7 100644 (file)
@@ -841,7 +841,7 @@ NdisOpenConfigurationKeyByIndex(
 
     /* should i fail instead if the passed-in string isn't long enough? */
     wcsncpy(KeyName->Buffer, KeyInformation->Name, KeyName->MaximumLength/sizeof(WCHAR));
-    KeyName->Length = (USHORT)KeyInformation->NameLength;
+    KeyName->Length = (USHORT)min(KeyInformation->NameLength, KeyName->MaximumLength);
 
     InitializeObjectAttributes(&KeyAttributes, KeyName, OBJ_CASE_INSENSITIVE, ConfigurationHandle, NULL);