OK, Thomas had to convince me that MAX_USHORT + MAX_USHORT + 0x400 + 0x6 cannot overflow an ULONG.
So remove useless check.
By Thomas :-)
svn path=/trunk/; revision=66358
/* Reserve enough to read previous string + to append our with required null chars */
BufferLength = NewPath->Length + ExistingPath->Length + STRING_LENGTH + 3 * sizeof(UNICODE_NULL);
- /* Check we didn't overflow */
- if (BufferLength < STRING_LENGTH)
- {
- NtClose(KeyHandle);
- return STATUS_BUFFER_TOO_SMALL;
- }
while (TRUE)
{
StringLength = DataSize;
RtlFreeHeap(RtlGetProcessHeap(), 0, Buffer);
BufferLength = ExistingPath->Length + StringLength + NewPath->Length + 3 * sizeof(UNICODE_NULL);
+ /* Check we didn't overflow */
if (BufferLength < StringLength)
{
NtClose(KeyHandle);