ntdll: Fix buffer allocation check in get_dir_data_space.

Sebastian Lackner sebastian at fds-team.de
Tue May 3 18:37:06 CDT 2016


Signed-off-by: Sebastian Lackner <sebastian at fds-team.de>
---

size already includes the terminating \0 character.

BTW: I assume its intentional that you realloc only the first buffer to release
     some space, right? In the worst case we are wasting up to about
     PATH_MAX * sizeof(WCHAR) space in the other buffers.

 dlls/ntdll/directory.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/dlls/ntdll/directory.c b/dlls/ntdll/directory.c
index 223b842..17104a3 100644
--- a/dlls/ntdll/directory.c
+++ b/dlls/ntdll/directory.c
@@ -296,7 +296,7 @@ static void *get_dir_data_space( struct dir_data *data, unsigned int size )
     struct dir_data_buffer *buffer = data->buffer;
     void *ret;
 
-    if (!buffer || size >= buffer->size - buffer->pos)
+    if (!buffer || size > buffer->size - buffer->pos)
     {
         unsigned int new_size = buffer ? buffer->size * 2 : dir_data_buffer_initial_size;
         if (new_size < size) new_size = size;
-- 
2.8.0



More information about the wine-patches mailing list