svn commit: samba r22897 - in branches/SAMBA_3_0_26/source/utils: .

Andrew Bartlett abartlet at samba.org
Tue May 15 12:28:32 GMT 2007


On Tue, 2007-05-15 at 11:12 +0000, obnox at samba.org wrote:
> Author: obnox
> Date: 2007-05-15 11:12:10 +0000 (Tue, 15 May 2007)
> New Revision: 22897
> 
> WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=22897
> 
> Log:
> Fix c++ warnings (add explicit casts). 

These calls would be much safer down without the casts, and with
talloc() and a structure assignment.  This would also tag the structure
with the correct name. 

I'm particularly worried by the cast being to (struct devicemode *), but
the sizeof() being for DEVICEMODE.  This is exactly the type of bug that
the new talloc() was written to avoid.

> Changeset:
> Modified: branches/SAMBA_3_0_26/source/utils/net_rpc_printer.c
> ===================================================================
> --- branches/SAMBA_3_0_26/source/utils/net_rpc_printer.c	2007-05-15 11:00:20 UTC (rev 22896)
> +++ branches/SAMBA_3_0_26/source/utils/net_rpc_printer.c	2007-05-15 11:12:10 UTC (rev 22897)
> @@ -2166,7 +2166,7 @@
>  		if (ctr_enum.printers_2[i].devmode != NULL) {
>  
>  			/* copy devmode (info level 2) */
> -			ctr_dst.printers_2->devmode =
> +			ctr_dst.printers_2->devmode = (struct devicemode *)
>  				TALLOC_MEMDUP(mem_ctx,
>  					      ctr_enum.printers_2[i].devmode,
>  					      sizeof(DEVICEMODE));

-- 
Andrew Bartlett                                http://samba.org/~abartlet/
Authentication Developer, Samba Team           http://samba.org
Samba Developer, Red Hat Inc.                  http://redhat.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
Url : http://lists.samba.org/archive/samba-technical/attachments/20070515/296d2603/attachment.bin


More information about the samba-technical mailing list