Author: cgutman
Date: Wed Jul 20 18:38:13 2011
New Revision: 52746
URL:
http://svn.reactos.org/svn/reactos?rev=52746&view=rev
Log:
[RTL]
- Fix a couple of potential null pointer accesses
Modified:
trunk/reactos/lib/rtl/path.c
Modified: trunk/reactos/lib/rtl/path.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/rtl/path.c?rev=52746&a…
==============================================================================
--- trunk/reactos/lib/rtl/path.c [iso-8859-1] (original)
+++ trunk/reactos/lib/rtl/path.c [iso-8859-1] Wed Jul 20 18:38:13 2011
@@ -210,6 +210,9 @@
Path = PathString->Buffer;
Chars = PathString->Length / sizeof(WCHAR);
+ /* Return if there are no characters */
+ if (!Chars) return RtlPathTypeUnknown;
+
/*
* The algorithm is similar to RtlDetermineDosPathNameType_U but here we
* actually check for the path length before touching the characters
@@ -291,7 +294,8 @@
/* Handle initial path type and failure case */
*PathType = RtlPathTypeUnknown;
- if (!(Size) || !(Buffer) || !(FileName) || (FileName->Buffer[0] == UNICODE_NULL))
return 0;
+ if (!(Size) || !(Buffer) || !(FileName) ||
+ !(FileName->Length) || (FileName->Buffer[0] == UNICODE_NULL)) return 0;
/* Break filename into component parts */
FileNameBuffer = FileName->Buffer;