PATCH: fix recent dlls/ntdll/sec.c change

Gerald Pfeifer pfeifer at dbai.tuwien.ac.at
Sun Aug 15 08:17:15 CDT 2004


The following change to dlls/ntdll/sec.c

   revision 1.44
   date: 2004/08/13 23:55:43;  author: julliard;  state: Exp;  lines: +83 -63
   Francois Gouget <fgouget at free.fr>
   Fix the PSID and PSECURITY_DESCRIPTOR types.
   Add PISID and PISECURITY_DESCRIPTOR.

introduced the following warning when using GCC 3.3

   sec.c:365: warning: invalid application of `sizeof' to a void type

And in fact, this is not just a warning -- that code seems to be 
completely broken, for PSECURITY_DESCRIPTOR is just a typedef for PVOID.



And please, pretty please, use current versions of GCC to test all 
patches, and do NOT just ignore warnings.  Surprisingly often, these
indicate real programming errors!


The patch below addresses this in a portable way.

Gerald

ChangeLog:
Fix incorrect sizeof in RtlCreateSecurityDescriptor().
Index: sec.c
===================================================================
RCS file: /home/wine/wine/dlls/ntdll/sec.c,v
retrieving revision 1.44
diff -u -3 -p -r1.44 sec.c
--- sec.c	13 Aug 2004 23:55:43 -0000	1.44
+++ sec.c	15 Aug 2004 13:06:56 -0000
@@ -362,7 +362,7 @@ NTSTATUS WINAPI RtlCreateSecurityDescrip
  {
  	if (rev!=SECURITY_DESCRIPTOR_REVISION)
  		return STATUS_UNKNOWN_REVISION;
-	memset(lpsd,'\0',sizeof(*lpsd));
+	memset(lpsd,'\0',sizeof(SECURITY_DESCRIPTOR));
  	((SECURITY_DESCRIPTOR*)lpsd)->Revision = SECURITY_DESCRIPTOR_REVISION;
  	return STATUS_SUCCESS;
  }



More information about the wine-patches mailing list