RE: Bug in gwlib/charset.c: int charset_convert(Octstr *string, c har *charset_from, char *charset_to)

"Pommnitz, Jörg" <[email protected]>
Newsgroups gmane.comp.mobile.kannel.devel
Message-ID <[email protected]>
No comment?

-----Ursprüngliche Nachricht-----
Von: Pommnitz, Jörg 
Gesendet: Montag, 22. November 2004 12:22
An: Kannel-Devel (E-Mail)
Betreff: Bug in gwlib/charset.c: int charset_convert(Octstr *string,
char *charset_from, char *charset_to)


Hi List,
the above mentioned function seems buggy to me. It takes the result of the
iconv operation and uses octstr_append_cstr(string, to_buf); to replace the
old contents with the new one. This can't possibly work when you convert to
say UTF-16 with zero-bytes in the middle of the result (quite likely).
I don't have a patch, but the right solution would probably be to use 

octstr_append_data(string, to_buf, pointer - to_buf);

instead of

octstr_append_cstr(string, to_buf);

Regards
  Joerg
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.