summaryrefslogtreecommitdiff
path: root/source3/lib
diff options
context:
space:
mode:
authorTim Potter <tpot@samba.org>2003-09-29 06:17:09 +0000
committerTim Potter <tpot@samba.org>2003-09-29 06:17:09 +0000
commit5400952f7f74d6e656fcf4ded173868ecec3cb77 (patch)
tree24ac373cfcffe454faaac14ffd7c8f572d7c2c63 /source3/lib
parent64dbd7cbff3fa7a4e560571ec38207a7176e4646 (diff)
downloadsamba-5400952f7f74d6e656fcf4ded173868ecec3cb77.tar.gz
samba-5400952f7f74d6e656fcf4ded173868ecec3cb77.tar.bz2
samba-5400952f7f74d6e656fcf4ded173868ecec3cb77.zip
Merge from 3.0:
>Fix for #480. Change the interface for init_unistr2 to not take a length >but a flags field. We were assuming that 2*strlen(mb_string) == length of ucs2-le string. >This is not the case. Count it after conversion. >Jeremy. (This used to be commit e2ab9e54cd0ec0002175cf18ff364f4aebaf85a0)
Diffstat (limited to 'source3/lib')
-rw-r--r--source3/lib/util_unistr.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/source3/lib/util_unistr.c b/source3/lib/util_unistr.c
index e7c200218e..e90a824395 100644
--- a/source3/lib/util_unistr.c
+++ b/source3/lib/util_unistr.c
@@ -819,22 +819,25 @@ UNISTR2* ucs2_to_unistr2(TALLOC_CTX *ctx, UNISTR2* dst, smb_ucs2_t* src)
{
size_t len;
- if (!src) return NULL;
+ if (!src)
+ return NULL;
len = strlen_w(src);
/* allocate UNISTR2 destination if not given */
if (!dst) {
dst = (UNISTR2*) talloc(ctx, sizeof(UNISTR2));
- if (!dst) return NULL;
+ if (!dst)
+ return NULL;
}
if (!dst->buffer) {
dst->buffer = (uint16*) talloc(ctx, sizeof(uint16) * (len + 1));
- if (!dst->buffer) return NULL;
+ if (!dst->buffer)
+ return NULL;
}
/* set UNISTR2 parameters */
dst->uni_max_len = len + 1;
- dst->undoc = 0;
+ dst->offset = 0;
dst->uni_str_len = len;
/* copy the actual unicode string */
@@ -842,4 +845,3 @@ UNISTR2* ucs2_to_unistr2(TALLOC_CTX *ctx, UNISTR2* dst, smb_ucs2_t* src)
return dst;
}
-