1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-23 17:34:34 +03:00

util/charset/convert: when retrying, retry from the start

iconv() advances the inbuf pointer; if we decide to realloc and re-iconv,
we need to reset inbuf to the source string

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
This commit is contained in:
Douglas Bagnall 2019-05-10 19:32:39 +12:00 committed by Andrew Bartlett
parent 02507ebf10
commit a6f47b4f75

View File

@ -351,7 +351,7 @@ bool convert_string_talloc_handle(TALLOC_CTX *ctx, struct smb_iconv_handle *ic,
{
size_t i_len, o_len, destlen;
size_t retval;
const char *inbuf = (const char *)src;
const char *inbuf = NULL;
char *outbuf = NULL, *ob = NULL;
smb_iconv_t descriptor;
void **dest = (void **)dst;
@ -430,6 +430,7 @@ bool convert_string_talloc_handle(TALLOC_CTX *ctx, struct smb_iconv_handle *ic,
outbuf = ob;
i_len = srclen;
o_len = destlen;
inbuf = (const char *)src;
retval = smb_iconv(descriptor,
&inbuf, &i_len,