- RtlCreateUnicodeString fails if the Length is > 0xFFFE on Windows NT 5.2 and higher. Spotted by Thomas.
Modified: trunk/reactos/lib/rtl/unicode.c

Modified: trunk/reactos/lib/rtl/unicode.c
--- trunk/reactos/lib/rtl/unicode.c	2005-11-01 23:39:12 UTC (rev 18943)
+++ trunk/reactos/lib/rtl/unicode.c	2005-11-01 23:54:39 UTC (rev 18944)
@@ -1943,6 +1943,8 @@
     PAGED_CODE_RTL();
 
     Length = (wcslen(Source) + 1) * sizeof(WCHAR);
+    if (Length > 0xFFFE) return FALSE;
+
     UniDest->Buffer = RtlpAllocateStringMemory(Length, TAG_USTR);
 
     if (UniDest->Buffer == NULL) return FALSE;