The Samba-Bugzilla – Bug 4800
bug in cac_unistr_ascii function
Last modified: 2007-07-23 09:01:23 UTC
When I use 'svc', which compiled from examples/libmsrpc/test/svcctl/svc.c, I found a bug in listting services:
if there are utf-8 chars(such as Chinese) in services displayname,we can only see a part of the string.
By debugging,I found the bug is from cac_unistr_ascii() function,
char *cac_unistr_ascii( TALLOC_CTX * mem_ctx, UNISTR src )
if ( !mem_ctx || !src.buffer )
len = unistrlen( src.buffer ) + 1;
buf = TALLOC_ZERO_ARRAY( mem_ctx, char, len );
if ( !buf )
rpcstr_pull( buf, src.buffer, len, -1, STR_TERMINATE ); // the 'len' is too short when conver to utf-8 : unicode string length is not equal to utf-8 string length,in this function, I use len*4 as the 3th param.
The libmsrpc code is currently unmaintained and has been removed
in the upcoming 3.2.0 release. Marking as LATER in hopes that
someone steps up.