Commit 05287335 authored by Rob Shearman's avatar Rob Shearman Committed by Alexandre Julliard

ntdll: Ignore the hole in the FILE_PIPE_WAIT_FOR_BUFFER structure passed into…

ntdll: Ignore the hole in the FILE_PIPE_WAIT_FOR_BUFFER structure passed into NtFsControlFile before writing the structure to the server.
parent eae5b071
......@@ -69,6 +69,9 @@
#ifdef HAVE_SYS_STATFS_H
# include <sys/statfs.h>
#endif
#ifdef HAVE_VALGRIND_MEMCHECK_H
# include <valgrind/memcheck.h>
#endif
#define NONAMELESSUNION
#define NONAMELESSSTRUCT
......@@ -1257,6 +1260,30 @@ static NTSTATUS server_ioctl_file( HANDLE handle, HANDLE event,
return status;
}
/* Tell Valgrind to ignore any holes in structs we will be passing to the
* server */
static void ignore_server_ioctl_struct_holes (ULONG code, const void *in_buffer,
ULONG in_size)
{
#ifdef VALGRIND_MAKE_MEM_DEFINED
# define IGNORE_STRUCT_HOLE(buf, size, t, f1, f2) \
do { \
if ((size) >= FIELD_OFFSET(t, f2) && \
FIELD_OFFSET(t, f1) + sizeof(((t *)0)->f1) < FIELD_OFFSET(t, f2)) \
VALGRIND_MAKE_MEM_DEFINED( \
(const char *)(buf) + FIELD_OFFSET(t, f1) + sizeof(((t *)0)->f1), \
FIELD_OFFSET(t, f2) - FIELD_OFFSET(t, f1) + sizeof(((t *)0)->f1)); \
} while (0)
switch (code)
{
case FSCTL_PIPE_WAIT:
IGNORE_STRUCT_HOLE(in_buffer, in_size, FILE_PIPE_WAIT_FOR_BUFFER, TimeoutSpecified, Name);
break;
}
#endif
}
/**************************************************************************
* NtDeviceIoControlFile [NTDLL.@]
......@@ -1356,6 +1383,8 @@ NTSTATUS WINAPI NtFsControlFile(HANDLE handle, HANDLE event, PIO_APC_ROUTINE apc
if (!io) return STATUS_INVALID_PARAMETER;
ignore_server_ioctl_struct_holes( code, in_buffer, in_size );
switch(code)
{
case FSCTL_DISMOUNT_VOLUME:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment