summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
Diffstat (limited to 'source3')
-rw-r--r--source3/lib/charcnv.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/source3/lib/charcnv.c b/source3/lib/charcnv.c
index f6028bb134..11b1448f1e 100644
--- a/source3/lib/charcnv.c
+++ b/source3/lib/charcnv.c
@@ -839,6 +839,9 @@ size_t push_ascii_nstring(void *dest, const char *src)
smb_panic("failed to create UCS2 buffer");
}
+ /* We're using buffer_len below to count ucs2 characters, not bytes. */
+ buffer_len /= sizeof(smb_ucs2_t);
+
dest_len = 0;
for (i = 0; buffer[i] != 0 && (i < buffer_len); i++) {
unsigned char mb[10];