diff options
Diffstat (limited to 'sys/netsmb')
-rw-r--r-- | sys/netsmb/smb_subr.c | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/sys/netsmb/smb_subr.c b/sys/netsmb/smb_subr.c index 0fb48ec..b8dab57 100644 --- a/sys/netsmb/smb_subr.c +++ b/sys/netsmb/smb_subr.c @@ -319,11 +319,20 @@ smb_maperror(int eclass, int eno) } static int -smb_copy_iconv(struct mbchain *mbp, c_caddr_t src, caddr_t dst, size_t len) +smb_copy_iconv(struct mbchain *mbp, c_caddr_t src, caddr_t dst, + size_t *srclen, size_t *dstlen) { - size_t outlen = len; + int error; + size_t inlen = *srclen, outlen = *dstlen; - return iconv_conv((struct iconv_drv*)mbp->mb_udata, &src, &len, &dst, &outlen); + error = iconv_conv((struct iconv_drv*)mbp->mb_udata, &src, &inlen, + &dst, &outlen); + if (inlen != *srclen || outlen != *dstlen) { + *srclen -= inlen; + *dstlen -= outlen; + return 0; + } else + return error; } int |