Author: dchapyshev
Date: Wed Feb 11 07:54:29 2009
New Revision: 39548
URL:
http://svn.reactos.org/svn/reactos?rev=39548&view=rev
Log:
- Add params checking. It fixes Autoruns (9.38) crashes
Modified:
trunk/reactos/dll/win32/kernel32/file/dir.c
Modified: trunk/reactos/dll/win32/kernel32/file/dir.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/kernel32/file/di…
==============================================================================
--- trunk/reactos/dll/win32/kernel32/file/dir.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/kernel32/file/dir.c [iso-8859-1] Wed Feb 11 07:54:29 2009
@@ -914,19 +914,23 @@
BufferU.Length = wcslen(BufferU.Buffer) * sizeof(WCHAR);
/* convert ansi (or oem) string to unicode */
if (bIsFileApiAnsi)
- RtlUnicodeStringToAnsiString (&Buffer,
- &BufferU,
- FALSE);
+ Status = RtlUnicodeStringToAnsiString(&Buffer,
+ &BufferU,
+ FALSE);
else
- RtlUnicodeStringToOemString (&Buffer,
- &BufferU,
- FALSE);
- /* nul-terminate ascii string */
- Buffer.Buffer[BufferU.Length / sizeof(WCHAR)] = '\0';
-
- if (NULL != lpFilePart && BufferU.Length != 0)
+ Status = RtlUnicodeStringToOemString(&Buffer,
+ &BufferU,
+ FALSE);
+
+ if (NT_SUCCESS(Status) && Buffer.Buffer)
{
+ /* nul-terminate ascii string */
+ Buffer.Buffer[BufferU.Length / sizeof(WCHAR)] = '\0';
+
+ if (NULL != lpFilePart && BufferU.Length != 0)
+ {
*lpFilePart = strrchr (lpBuffer, '\\') + 1;
+ }
}
}