bug in HEAD: init_unistr2_from_unistr

Jean Francois Micouleau Jean-Francois.Micouleau at dalalu.fr
Sat Aug 5 16:20:25 GMT 2000

On Sat, 5 Aug 2000, Elrond wrote:

> since I haven't asked, wether I may modify HEAD:
> in rpc_parse/parse_misc.c:init_unistr2_from_unistr
> 	if ((from->buffer)[i]=='\0' && (from->buffer)[(2*i)+1]=='\0')
> should only be:
> 	if (from->buffer[i]==0)
> the buffer is already a "uint16 *", and accessing 2*i+1 is
> likely to be out of allocated memory.

you can rewrite the while loop without the if:

	while (from->buffer[i++] !=0 );

the if(!found) test can be removed. You just have to hope the string is

the string copy can be a simple:

memcpy( to->buffer, from->buffer, to->uni_str_len*sizeof(uint16) );

>     Elrond
> p.s.: Or where should I post this?

samba-technical is fine.


More information about the samba-technical mailing list