From: Douglas Bagnall Date: Fri, 10 May 2019 07:32:39 +0000 (+1200) Subject: util/charset/convert: when retrying, retry from the start X-Git-Tag: tdb-1.4.1~39 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=a6f47b4f7581e0a160fc844efc78e213c6546aee;p=thirdparty%2Fsamba.git 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 Reviewed-by: Andrew Bartlett --- diff --git a/lib/util/charset/convert_string.c b/lib/util/charset/convert_string.c index 45912142678..baff3d9e308 100644 --- a/lib/util/charset/convert_string.c +++ b/lib/util/charset/convert_string.c @@ -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,