Correct Length value in case string is truncated
svn path=/trunk/; revision=51159
/* should i fail instead if the passed-in string isn't long enough? */
wcsncpy(KeyName->Buffer, KeyInformation->Name, KeyName->MaximumLength/sizeof(WCHAR));
/* 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);
InitializeObjectAttributes(&KeyAttributes, KeyName, OBJ_CASE_INSENSITIVE, ConfigurationHandle, NULL);