summaryrefslogtreecommitdiff
path: root/source3/lib/charcnv.c
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2007-12-04 15:21:14 -0800
committerJeremy Allison <jra@samba.org>2007-12-04 15:21:14 -0800
commit5ea101f048483899d4a0a36c7eb6e768e408feec (patch)
tree03730ca2033f29f76edb14eb24b8e28d555f70c3 /source3/lib/charcnv.c
parente883c7040b707128b2838938d4576a2cc5cfb400 (diff)
downloadsamba-5ea101f048483899d4a0a36c7eb6e768e408feec.tar.gz
samba-5ea101f048483899d4a0a36c7eb6e768e408feec.tar.bz2
samba-5ea101f048483899d4a0a36c7eb6e768e408feec.zip
Allow STR_TERMINATE and -1 src_len for pull_ucs2_base_talloc().
Jeremy. (This used to be commit 063358d87ac9a1d948c8d4b6358e926dd14bb3ac)
Diffstat (limited to 'source3/lib/charcnv.c')
-rw-r--r--source3/lib/charcnv.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/source3/lib/charcnv.c b/source3/lib/charcnv.c
index 0dfa88e87e..9592bbc287 100644
--- a/source3/lib/charcnv.c
+++ b/source3/lib/charcnv.c
@@ -592,7 +592,7 @@ size_t convert_string_allocate(TALLOC_CTX *ctx, charset_t from, charset_t to,
goto use_as_is;
break;
case E2BIG:
- goto convert;
+ goto convert;
case EILSEQ:
reason="Illegal multibyte sequence";
if (!conv_silent)
@@ -1503,6 +1503,12 @@ size_t pull_ucs2_base_talloc(TALLOC_CTX *ctx,
if (len < src_len/2)
len++;
src_len = len*2;
+ } else {
+ /*
+ * src_len == -1 - alloc interface won't take this
+ * so we must calculate.
+ */
+ src_len = (strlen_w((const smb_ucs2_t *)src)+1)*sizeof(smb_ucs2_t);
}
/* Ensure we don't use an insane length from the client. */
if (src_len >= 1024*1024) {