patch for samba4

Lunar Child luch at etersoft.ru
Wed Feb 7 11:33:47 GMT 2007


tridge at samba.org wrote:
> Jelmer,
>
>  > > The reason: torture/rpc/rpc.c:120: warning: assignment discards
>  > > qualifiers from pointer target type
>  > > patch name: rpc.patch
>  > Committed, thanks.
>
> Did you test this Jelmer?
>
> I know it gets rid of a warning, but it doesn't look right to me. I
> haven't tried it, but it looks like this will cause a crash with that
> patch.
>
> With the patch we now store the pointer like this:
>
>        const struct dcerpc_interface_table *table;
>        ...
>        tcase->data = (void *)&table;
>
> and retrieve it like this:
>
> 	status = torture_rpc_connection(tctx, 
> 				(struct dcerpc_pipe **)data, 
> 				(const struct dcerpc_interface_table *)tctx->active_tcase->data);
>
> that will crash, as tcase->data now contains a stack value from a
> returned function. So it points off into space.
>
> I think the correct fix is:
>
>        tcase->data = discard_const(table);
>
> alternatively, make tcase->data a const.
>
> Another example of "don't just fix a warning, fix the bug" :-)
>
> Cheers, Tridge
>   
ooh!
I`m sorry!
I will try to be corrected.



More information about the samba-technical mailing list