From f55172c51c9bd27c72bf6d7af877926bac90a8f8 Mon Sep 17 00:00:00 2001 From: Simo Sorce Date: Tue, 9 Oct 2001 19:12:48 +0000 Subject: old fixes I forgot to commit (This used to be commit 7895593929f443c6a256d2a13035aee11bed3dbf) --- source3/lib/util_unistr.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'source3/lib') diff --git a/source3/lib/util_unistr.c b/source3/lib/util_unistr.c index 1e73669e4e..7d690ecb9c 100644 --- a/source3/lib/util_unistr.c +++ b/source3/lib/util_unistr.c @@ -297,14 +297,14 @@ smb_ucs2_t *strdup_w(const smb_ucs2_t *src) smb_ucs2_t *dest; uint32 len; - len = strlen_w(src); - dest = (smb_ucs2_t *)malloc((len+1)*sizeof(smb_ucs2_t)); + len = strlen_w(src) + 1; + dest = (smb_ucs2_t *)malloc(len*sizeof(smb_ucs2_t)); if (!dest) { DEBUG(0,("strdup_w: out of memory!\n")); return NULL; } - memcpy(dest, src, (len+1)*sizeof(smb_ucs2_t)); + memcpy(dest, src, len*sizeof(smb_ucs2_t)); return dest; } @@ -343,8 +343,8 @@ smb_ucs2_t *strncat_w(smb_ucs2_t *dest, const smb_ucs2_t *src, const size_t max) len = strlen_w(src); if (len > max) len = max; - memcpy(&dest[start], src, len); - dest[start+len+1] = 0; + memcpy(&dest[start], src, len*sizeof(smb_ucs2_t)); + dest[start+len] = 0; return dest; } -- cgit