Patch by Amine Khaldi: Fix buffer length check
authorTimo Kreuzer <timo.kreuzer@reactos.org>
Thu, 31 Dec 2009 14:44:33 +0000 (14:44 +0000)
committerTimo Kreuzer <timo.kreuzer@reactos.org>
Thu, 31 Dec 2009 14:44:33 +0000 (14:44 +0000)
svn path=/trunk/; revision=44824

reactos/base/applications/cacls/cacls.c

index 023232d..0ad9789 100644 (file)
@@ -180,14 +180,14 @@ BOOL
 PrintFileDacl(IN LPTSTR FilePath,
               IN LPTSTR FileName)
 {
 PrintFileDacl(IN LPTSTR FilePath,
               IN LPTSTR FileName)
 {
-    SIZE_T Indent;
+    SIZE_T Length;
     PSECURITY_DESCRIPTOR SecurityDescriptor;
     DWORD SDSize = 0;
     TCHAR FullFileName[MAX_PATH + 1];
     BOOL Error = FALSE, Ret = FALSE;
 
     PSECURITY_DESCRIPTOR SecurityDescriptor;
     DWORD SDSize = 0;
     TCHAR FullFileName[MAX_PATH + 1];
     BOOL Error = FALSE, Ret = FALSE;
 
-    Indent = _tcslen(FilePath) + _tcslen(FileName);
-    if (Indent++ > MAX_PATH - 1)
+    Length = _tcslen(FilePath) + _tcslen(FileName);
+    if (Length > MAX_PATH)
     {
         /* file name too long */
         SetLastError(ERROR_FILE_NOT_FOUND);
     {
         /* file name too long */
         SetLastError(ERROR_FILE_NOT_FOUND);