Bug 4800 - bug in cac_unistr_ascii function
bug in cac_unistr_ascii function
Product: Samba 3.0
Classification: Unclassified
Component: Extended Characters
x86 Linux
: P3 normal
: none
Assigned To: Alexander Bokovoy
Samba QA Contact
Depends on:
  Show dependency treegraph
Reported: 2007-07-19 03:38 UTC by netwalker@126.com
Modified: 2007-07-23 09:01 UTC (History)
0 users

See Also:


Note You need to log in before you can comment on or make changes to this bug.
Description netwalker@126.com 2007-07-19 03:38:52 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,
------ source/libmsrpc/libmsrpc_internal.c:687
char *cac_unistr_ascii( TALLOC_CTX * mem_ctx, UNISTR src )
    char *buf;
    uint32 len;

    if ( !mem_ctx || !src.buffer )
        return NULL;

    len = unistrlen( src.buffer ) + 1;

    buf = TALLOC_ZERO_ARRAY( mem_ctx, char, len );
    if ( !buf )
        return NULL;

    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.

    return buf;
Comment 1 Gerald (Jerry) Carter 2007-07-23 09:01:23 UTC
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.