From 5400952f7f74d6e656fcf4ded173868ecec3cb77 Mon Sep 17 00:00:00 2001 From: Tim Potter Date: Mon, 29 Sep 2003 06:17:09 +0000 Subject: 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) --- source3/lib/util_unistr.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'source3/lib') 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; } - -- cgit