ntdll-Fix_Free: Move fix for invalid memory access to patch 9, which introduced the error.

This commit is contained in:
Sebastian Lackner 2014-08-28 07:26:53 +02:00
parent 125673271d
commit ece1d51745
12 changed files with 37 additions and 24 deletions

View File

@ -541,7 +541,7 @@ ntdll-Fix_Free.ok:
$(call APPLY_FILE,ntdll-Fix_Free/0008-ntdll-Fix-leak-on-STATUS_NO_SUCH_FILE-for-certain-di.patch)
$(call APPLY_FILE,ntdll-Fix_Free/0009-kernel32-Fix-leak-on-STATUS_NO_SUCH_FILE-in-RemoveDi.patch)
$(call APPLY_FILE,ntdll-Fix_Free/0010-kernel32-Fix-leak-on-STATUS_NO_SUCH_FILE-in-QueryDos.patch)
$(call APPLY_FILE,ntdll-Fix_Free/0011-kernel32-Fix-a-leak-and-invalid-memory-access-in-Rem.patch)
$(call APPLY_FILE,ntdll-Fix_Free/0011-kernel32-Fix-leaking-directory-handle-in-RemoveDirec.patch)
@( \
echo '+ { "ntdll-Fix_Free", "Erich E. Hoover", "Fix unintentional leaks with ntdll internals [rev 2]" },'; \
) > ntdll-Fix_Free.ok

View File

@ -1,4 +1,4 @@
From 1725bf5deb419b54306c70b1d3b23259236b2090 Mon Sep 17 00:00:00 2001
From 87680099180ae97cdd4ab0060929e77a93ca453c Mon Sep 17 00:00:00 2001
From: "Erich E. Hoover" <erich.e.hoover@gmail.com>
Date: Thu, 21 Aug 2014 22:31:53 -0600
Subject: ntdll: Make nt_to_unix_file_name_attr return always safe to free.

View File

@ -1,4 +1,4 @@
From 8298ecb1d1eead39e9333670e79a7136ca60db50 Mon Sep 17 00:00:00 2001
From 3fdd706cddf8cf517f38488f445ca4ab30bba088 Mon Sep 17 00:00:00 2001
From: "Erich E. Hoover" <erich.e.hoover@gmail.com>
Date: Thu, 21 Aug 2014 22:35:55 -0600
Subject: ntdll: Make wine_nt_to_unix_file_name return always safe to free.

View File

@ -1,4 +1,4 @@
From 2bde34705bcb0cf25affb6744df736611736a869 Mon Sep 17 00:00:00 2001
From 4394fbad092e3786360b6f7099500e26e5dbaa71 Mon Sep 17 00:00:00 2001
From: "Erich E. Hoover" <erich.e.hoover@gmail.com>
Date: Thu, 21 Aug 2014 22:28:10 -0600
Subject: ntdll: Make file_id_to_unix_file_name return always safe to free.

View File

@ -1,4 +1,4 @@
From 01ee64a9b96003315c521704c4e8e27b0f832b82 Mon Sep 17 00:00:00 2001
From e77e75d4bc2bddb96f1c1819172ac753f4508e53 Mon Sep 17 00:00:00 2001
From: "Erich E. Hoover" <erich.e.hoover@gmail.com>
Date: Thu, 21 Aug 2014 22:40:09 -0600
Subject: ntdll: Fix leak on STATUS_NO_SUCH_FILE in NtQueryFullAttributesFile.

View File

@ -1,4 +1,4 @@
From 7ea279c6afb68865bfb6f09233e3d0fb2915fbfd Mon Sep 17 00:00:00 2001
From 9b0b9ca377c6d93866c27b262d0b774e565e4cd3 Mon Sep 17 00:00:00 2001
From: "Erich E. Hoover" <erich.e.hoover@gmail.com>
Date: Thu, 21 Aug 2014 22:40:44 -0600
Subject: ntdll: Fix leak on STATUS_NO_SUCH_FILE in NtQueryAttributesFile.

View File

@ -1,4 +1,4 @@
From fa2f0ec87a3a0b7e4d176b8a334477bbb404bc07 Mon Sep 17 00:00:00 2001
From f9af5e33f532b5bcc4c9e4195efe54bbb29ed826 Mon Sep 17 00:00:00 2001
From: "Erich E. Hoover" <erich.e.hoover@gmail.com>
Date: Thu, 21 Aug 2014 22:45:34 -0600
Subject: ntdll: Fix unlikely leak on STATUS_NO_SUCH_FILE in init_redirects.

View File

@ -1,4 +1,4 @@
From 7d32863a7f2a412b5f42d4a60ba683d92911a251 Mon Sep 17 00:00:00 2001
From c8c9fa7bab2da87b6a14380265cf88bc53eea6de Mon Sep 17 00:00:00 2001
From: "Erich E. Hoover" <erich.e.hoover@gmail.com>
Date: Thu, 21 Aug 2014 22:57:06 -0600
Subject: ntdll: Fix leak on STATUS_NO_SUCH_FILE in load_builtin_dll.

View File

@ -1,4 +1,4 @@
From a7f6ef878680392871f8d2e00e06877fdb4182a5 Mon Sep 17 00:00:00 2001
From 8a03ff8a255dc1a685a963acb3d6ae26478b6a6b Mon Sep 17 00:00:00 2001
From: "Erich E. Hoover" <erich.e.hoover@gmail.com>
Date: Thu, 21 Aug 2014 23:09:02 -0600
Subject: ntdll: Fix leak on STATUS_NO_SUCH_FILE (for certain dispositions) in

View File

@ -1,17 +1,25 @@
From d52a094e2e5831a52fac98016fc71879edc8193e Mon Sep 17 00:00:00 2001
From a2c8ef31f29e7e6473c6c0c35a7b9681bc99f1da Mon Sep 17 00:00:00 2001
From: "Erich E. Hoover" <erich.e.hoover@gmail.com>
Date: Thu, 21 Aug 2014 22:50:19 -0600
Subject: kernel32: Fix leak on STATUS_NO_SUCH_FILE in RemoveDirectoryW.
---
dlls/kernel32/path.c | 1 +
1 file changed, 1 insertion(+)
dlls/kernel32/path.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/dlls/kernel32/path.c b/dlls/kernel32/path.c
index 09fb04b..eeba48a 100644
index 09fb04b..4a41ab8 100644
--- a/dlls/kernel32/path.c
+++ b/dlls/kernel32/path.c
@@ -1619,6 +1619,7 @@ BOOL WINAPI RemoveDirectoryW( LPCWSTR path )
@@ -1602,6 +1602,7 @@ BOOL WINAPI RemoveDirectoryW( LPCWSTR path )
SetLastError( ERROR_PATH_NOT_FOUND );
return FALSE;
}
+ unix_name.Buffer = NULL;
attr.Length = sizeof(attr);
attr.RootDirectory = 0;
attr.Attributes = OBJ_CASE_INSENSITIVE;
@@ -1619,6 +1620,7 @@ BOOL WINAPI RemoveDirectoryW( LPCWSTR path )
if (status != STATUS_SUCCESS)
{
SetLastError( RtlNtStatusToDosError(status) );

View File

@ -1,4 +1,4 @@
From 608a327fb5ee53f6c2b5fd0a937bd7e67df98820 Mon Sep 17 00:00:00 2001
From 8951f3f246da65fe632e54d0e9cbb347df231f70 Mon Sep 17 00:00:00 2001
From: "Erich E. Hoover" <erich.e.hoover@gmail.com>
Date: Thu, 21 Aug 2014 22:54:09 -0600
Subject: kernel32: Fix leak on STATUS_NO_SUCH_FILE in QueryDosDeviceW.

View File

@ -1,20 +1,25 @@
From 09d194aee9e84242a2843711947a72426fc8678c Mon Sep 17 00:00:00 2001
From cecc1c37484bd63da728d6dcde7aca633019bdca Mon Sep 17 00:00:00 2001
From: Sebastian Lackner <sebastian@fds-team.de>
Date: Thu, 28 Aug 2014 05:36:01 +0200
Subject: kernel32: Fix a leak and invalid memory access in RemoveDirectoryW.
Subject: kernel32: Fix leaking directory handle in RemoveDirectoryW.
NtClose( handle ) was missing on the error path, besides that unix_name is
not always initialized, and might contain garbage values - don't run
RtlFreeAnsiString in this case.
---
dlls/kernel32/path.c | 15 +++++++++------
1 file changed, 9 insertions(+), 6 deletions(-)
dlls/kernel32/path.c | 16 +++++++++-------
1 file changed, 9 insertions(+), 7 deletions(-)
diff --git a/dlls/kernel32/path.c b/dlls/kernel32/path.c
index eeba48a..593cc1d 100644
index 4a41ab8..593cc1d 100644
--- a/dlls/kernel32/path.c
+++ b/dlls/kernel32/path.c
@@ -1612,18 +1612,21 @@ BOOL WINAPI RemoveDirectoryW( LPCWSTR path )
@@ -1602,7 +1602,6 @@ BOOL WINAPI RemoveDirectoryW( LPCWSTR path )
SetLastError( ERROR_PATH_NOT_FOUND );
return FALSE;
}
- unix_name.Buffer = NULL;
attr.Length = sizeof(attr);
attr.RootDirectory = 0;
attr.Attributes = OBJ_CASE_INSENSITIVE;
@@ -1613,18 +1612,21 @@ BOOL WINAPI RemoveDirectoryW( LPCWSTR path )
status = NtOpenFile( &handle, DELETE, &attr, &io,
FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE,
FILE_DIRECTORY_FILE | FILE_SYNCHRONOUS_IO_NONALERT );