summaryrefslogtreecommitdiffstats
path: root/source/lib
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2004-03-18 17:58:50 +0000
committerJeremy Allison <jra@samba.org>2004-03-18 17:58:50 +0000
commite8b68ef965ea2e3bed41cb397ef32df05c631e92 (patch)
tree4d352090a1b422ec6eafa9f0b6abba00f2f3f0b0 /source/lib
parent3744d282badbe2fdc67e3ac309a0a0226d63173a (diff)
downloadsamba-e8b68ef965ea2e3bed41cb397ef32df05c631e92.tar.gz
samba-e8b68ef965ea2e3bed41cb397ef32df05c631e92.tar.xz
samba-e8b68ef965ea2e3bed41cb397ef32df05c631e92.zip
Correctness patch from fumiya@miraclelinux.com to count characters correctly,
doesn't affect what got put on the wire. Jeremy.
Diffstat (limited to 'source/lib')
-rw-r--r--source/lib/charcnv.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/source/lib/charcnv.c b/source/lib/charcnv.c
index f6028bb1341..11b1448f1eb 100644
--- a/source/lib/charcnv.c
+++ b/source/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];