summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimo Sorce <idra@samba.org>2001-10-09 19:12:48 +0000
committerSimo Sorce <idra@samba.org>2001-10-09 19:12:48 +0000
commitf55172c51c9bd27c72bf6d7af877926bac90a8f8 (patch)
treef0870b898e23cfcc3200efdb8916035891142f4e
parent52341e94a86420368b479acd2c760468444fef72 (diff)
downloadsamba-f55172c51c9bd27c72bf6d7af877926bac90a8f8.tar.gz
samba-f55172c51c9bd27c72bf6d7af877926bac90a8f8.tar.bz2
samba-f55172c51c9bd27c72bf6d7af877926bac90a8f8.zip
old fixes I forgot to commit
(This used to be commit 7895593929f443c6a256d2a13035aee11bed3dbf)
-rw-r--r--source3/lib/util_unistr.c10
1 files changed, 5 insertions, 5 deletions
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;
}