iconv_inconvenience and ndr_print_*

Jelmer Vernooij jelmer at samba.org
Fri Jun 12 01:24:17 GMT 2009


Andrew Bartlett wrote:
> On Fri, 2009-06-12 at 02:29 +0200, Jelmer Vernooij wrote:
>> -----BEGIN PGP SIGNED MESSAGE-----
>> Hash: SHA1
>>
>> Hi Tridge,
>>
>> tridge at samba.org wrote:
>>> The ndr_print_*() functions can end up calling string conversions via
>>> ndr_size_*() functions which call ndr_push functions, which call
>>> string conversion.
>>>
>>> Unfortunately ndr_print_*() functions create their own "struct
>>> ndr_print" structures, and don't setup ndr->iconv_convenience. So it
>>> segfaults when the first structure with a string is run through a
>>> ndr_size call.
>>>
>>> My fix at the moment is below, but I suspect you may want a different
>>> approach.
>> Ideally we should be specifying the iconv convenience to all of these
>> functions, but I'm not sure how doable that is given the large number of
>> callers.
>>
>> Your patch is a step forward at least (crashing is bad :-), we can
>> always change the callers to explicitly specify an iconv convenience later.
> 
> Don't we just need to change the pidl output and ndr_print_debug() and
> associated macros to look at p->conn->iconv_convenience?

There's also a lot of other places (outside of the generated code) that
call ndr_print_*(). It should be doable, but quite a bit of work

Cheers,

Jelmer


More information about the samba-technical mailing list