From a6f47b4f7581e0a160fc844efc78e213c6546aee Mon Sep 17 00:00:00 2001 From: Douglas Bagnall Date: Fri, 10 May 2019 19:32:39 +1200 Subject: [PATCH] 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 --- lib/util/charset/convert_string.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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,