]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
Correctness patch from fumiya@miraclelinux.com to count characters correctly,
authorJeremy Allison <jra@samba.org>
Thu, 18 Mar 2004 17:58:47 +0000 (17:58 +0000)
committerJeremy Allison <jra@samba.org>
Thu, 18 Mar 2004 17:58:47 +0000 (17:58 +0000)
doesn't affect what got put on the wire.
Jeremy.
(This used to be commit 05243a8de06b6589e2405a4a7be25cdf5d338c10)

source3/lib/charcnv.c

index f6028bb13415c1bdd44a25641e034f8d26730998..11b1448f1eb228dc314e130df8d87561fe3bba48 100644 (file)
@@ -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];