summaryrefslogtreecommitdiff
path: root/lib/util
diff options
context:
space:
mode:
authorDouglas Bagnall <douglas.bagnall@catalyst.net.nz>2019-05-10 19:32:39 +1200
committerAndrew Bartlett <abartlet@samba.org>2019-05-15 04:03:37 +0000
commita6f47b4f7581e0a160fc844efc78e213c6546aee (patch)
treeacaa871f9aa6b0e3ece929ee11a9e037a56a9ac1 /lib/util
parent02507ebf10eb6c038ef2ebc1e1aa6a4bd53eeecd (diff)
downloadsamba-a6f47b4f7581e0a160fc844efc78e213c6546aee.tar.gz
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>
Diffstat (limited to 'lib/util')
-rw-r--r--lib/util/charset/convert_string.c3
1 files changed, 2 insertions, 1 deletions
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,