Index: source/lib/charcnv.c =================================================================== RCS file: /cvsroot/samba/source/lib/charcnv.c,v retrieving revision 1.55.2.28 diff -u -r1.55.2.28 charcnv.c --- source/lib/charcnv.c 3 Jul 2003 19:11:28 -0000 1.55.2.28 +++ source/lib/charcnv.c 12 Jul 2003 20:45:27 -0000 @@ -254,9 +254,18 @@ } i_len = srclen; o_len = destlen; - retval = smb_iconv(descriptor, - &inbuf, &i_len, - &outbuf, &o_len); + do { + retval = smb_iconv(descriptor, + &inbuf, &i_len, + &outbuf, &o_len); + inbuf++; i_len--; + if (i_len <= 0) + break; + } while (retval == (size_t)-1 && (errno == EINVAL || errno == EILSEQ)); + /* Skip over any invalid input bytes; this should never happen with + UCS-2 unless we're on the second to last byte, so we shouldn't + have to worry about being out of phase on UCS2 input. */ + if(retval == (size_t)-1) { const char *reason="unknown error"; switch(errno) {