diff options
author | Jeremy Allison <jra@samba.org> | 2003-09-10 02:21:24 +0000 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2003-09-10 02:21:24 +0000 |
commit | ee51d6aabe9398a9b4a3bf99d8b6f3c23cdc075c (patch) | |
tree | 4b52f61f86479f00849c655a208101f732422f4f | |
parent | 89771b45bb0bd86a6a2a70fe0f03b2560358dddd (diff) | |
download | samba-ee51d6aabe9398a9b4a3bf99d8b6f3c23cdc075c.tar.gz samba-ee51d6aabe9398a9b4a3bf99d8b6f3c23cdc075c.tar.bz2 samba-ee51d6aabe9398a9b4a3bf99d8b6f3c23cdc075c.zip |
Fix mb bug in fast path code. strlen_w() returns number of *characters*
not number of bytes. Reproduce this by trying to rename the file named :
sibréseau -> sibréseaU
from Windows 2000 explorer.
Jeremy.
(This used to be commit 035f59599514491609078ac0fe5804278c43a9b3)
-rw-r--r-- | source3/lib/charcnv.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/source3/lib/charcnv.c b/source3/lib/charcnv.c index 5f3cf64a68..e8ae40dbe2 100644 --- a/source3/lib/charcnv.c +++ b/source3/lib/charcnv.c @@ -284,7 +284,7 @@ size_t convert_string(charset_t from, charset_t to, /* If all characters are ascii, fast path here. */ while ((srclen >= 2) && destlen) { - if ((lastp = *p) <= 0x7f && p[1] == 0) { + if (((lastp = *p) <= 0x7f) && (p[1] == 0)) { *q++ = *p; if (srclen != (size_t)-1) { srclen -= 2; @@ -296,7 +296,7 @@ size_t convert_string(charset_t from, charset_t to, break; } else { if (srclen == (size_t)-1) { - srclen = strlen_w((const void *)p)+2; + srclen = (strlen_w((const smb_ucs2_t *)p)+1) * 2; } return retval + convert_string_internal(from, to, p, srclen, q, destlen); } @@ -542,7 +542,7 @@ char *strdup_upper(const char *s) strupper_w(buffer); - size = convert_string(CH_UCS2, CH_UNIX, buffer, sizeof(buffer), out_buffer, sizeof(out_buffer)); + size = convert_string(CH_UCS2, CH_UNIX, buffer, -1, out_buffer, sizeof(out_buffer)); if (size == -1) { return NULL; } |