smb_iconv modifies constant input strings

Andrew Bartlett abartlet at samba.org
Sat Sep 27 01:17:19 GMT 2003


On Sat, 2003-09-27 at 11:09, Matt Seitz wrote:
> The "smb_iconv" function takes a "const char **" input string argument, but then 
> passes the input string to "iconv", which modifies the input string.  This led 
> to unexpected data corruption in some code I wrote that called "smb_iconv".
> 
> Could "smb_iconv" be modified to either:
> 
> a) declare its input string argument as "char **", or
> 
> b) create an internal copy of the input buffer, so that the original is not modified

Neither of these options are very good.  Samba's use of iconv() really
does assume it behaves in the way descriped in the linux manpage - which
declares it as char ** input, but does not modify the input string.  

We make a *lot* of calls to iconv(), and making an extra copy of every
string is going to be very costly.

Can you describe your platform, so we can see if this is specific to a
particular iconv() implementation?

Andrew Bartlett

-- 
Andrew Bartlett                                 abartlet at pcug.org.au
Manager, Authentication Subsystems, Samba Team  abartlet at samba.org
Student Network Administrator, Hawker College   abartlet at hawkerc.net
http://samba.org     http://build.samba.org     http://hawkerc.net
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
Url : http://lists.samba.org/archive/samba-technical/attachments/20030927/85abe232/attachment.bin


More information about the samba-technical mailing list