Commit be40b01c authored by Alexandre Julliard's avatar Alexandre Julliard

server: Align object attributes to a DWORD-boundary.

parent a6d89db6
...@@ -114,6 +114,8 @@ NTSTATUS alloc_object_attributes( const OBJECT_ATTRIBUTES *attr, struct object_a ...@@ -114,6 +114,8 @@ NTSTATUS alloc_object_attributes( const OBJECT_ATTRIBUTES *attr, struct object_a
} }
else if (attr->RootDirectory) return STATUS_OBJECT_NAME_INVALID; else if (attr->RootDirectory) return STATUS_OBJECT_NAME_INVALID;
len = (len + 3) & ~3; /* DWORD-align the entire structure */
*ret = RtlAllocateHeap( GetProcessHeap(), HEAP_ZERO_MEMORY, len ); *ret = RtlAllocateHeap( GetProcessHeap(), HEAP_ZERO_MEMORY, len );
if (!*ret) return STATUS_NO_MEMORY; if (!*ret) return STATUS_NO_MEMORY;
......
...@@ -6535,6 +6535,6 @@ union generic_reply ...@@ -6535,6 +6535,6 @@ union generic_reply
struct terminate_job_reply terminate_job_reply; struct terminate_job_reply terminate_job_reply;
}; };
#define SERVER_PROTOCOL_VERSION 559 #define SERVER_PROTOCOL_VERSION 560
#endif /* __WINE_WINE_SERVER_PROTOCOL_H */ #endif /* __WINE_WINE_SERVER_PROTOCOL_H */
...@@ -214,16 +214,15 @@ const struct object_attributes *get_req_object_attributes( const struct security ...@@ -214,16 +214,15 @@ const struct object_attributes *get_req_object_attributes( const struct security
/* return a pointer to the request data following an object attributes structure */ /* return a pointer to the request data following an object attributes structure */
const void *get_req_data_after_objattr( const struct object_attributes *attr, data_size_t *len ) const void *get_req_data_after_objattr( const struct object_attributes *attr, data_size_t *len )
{ {
const void *ptr; data_size_t size = (sizeof(*attr) + (attr->sd_len & ~1) + (attr->name_len & ~1) + 3) & ~3;
if (attr == &empty_attributes) if (attr == &empty_attributes || size >= get_req_data_size())
{ {
*len = 0; *len = 0;
return NULL; return NULL;
} }
ptr = (const WCHAR *)(attr + 1) + attr->sd_len / sizeof(WCHAR) + attr->name_len / sizeof(WCHAR); *len = get_req_data_size() - size;
*len = get_req_data_size() - ((const char *)ptr - (const char *)get_req_data()); return (const char *)get_req_data() + size;
return ptr;
} }
/* write the remaining part of the reply */ /* write the remaining part of the reply */
......
...@@ -1119,8 +1119,7 @@ static void dump_varargs_object_attributes( const char *prefix, data_size_t size ...@@ -1119,8 +1119,7 @@ static void dump_varargs_object_attributes( const char *prefix, data_size_t size
fprintf( stderr, ",name=L\"" ); fprintf( stderr, ",name=L\"" );
dump_strW( str, objattr->name_len / sizeof(WCHAR), stderr, "\"\"" ); dump_strW( str, objattr->name_len / sizeof(WCHAR), stderr, "\"\"" );
fputc( '\"', stderr ); fputc( '\"', stderr );
remove_data( ((sizeof(*objattr) + objattr->sd_len) / sizeof(WCHAR)) * sizeof(WCHAR) + remove_data( (sizeof(*objattr) + (objattr->sd_len & ~1) + (objattr->name_len & ~1) + 3) & ~3 );
(objattr->name_len / sizeof(WCHAR)) * sizeof(WCHAR) );
} }
fputc( '}', stderr ); fputc( '}', stderr );
} }
......
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