summaryrefslogtreecommitdiff
path: root/source3/lib/util_unistr.c
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2001-06-23 07:22:16 +0000
committerJeremy Allison <jra@samba.org>2001-06-23 07:22:16 +0000
commit37eb0d6c74ce158b1cc268cea446b33789550048 (patch)
tree53db3f7b7c381be854d8493ef7ac3e353bd640e4 /source3/lib/util_unistr.c
parent7133aed083612480a94a7b61d6a0a0308c304b6e (diff)
downloadsamba-37eb0d6c74ce158b1cc268cea446b33789550048.tar.gz
samba-37eb0d6c74ce158b1cc268cea446b33789550048.tar.bz2
samba-37eb0d6c74ce158b1cc268cea446b33789550048.zip
Added other_safe_chars to alpha_strcpy(). Needs testing but is a better
fix for the problem. Jeremy. (This used to be commit e059fffd03a1382fb2b7059b6de369d9fc765a17)
Diffstat (limited to 'source3/lib/util_unistr.c')
-rw-r--r--source3/lib/util_unistr.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/source3/lib/util_unistr.c b/source3/lib/util_unistr.c
index 7058665145..96aa62a283 100644
--- a/source3/lib/util_unistr.c
+++ b/source3/lib/util_unistr.c
@@ -1453,9 +1453,10 @@ BOOL str_is_all_w(const smb_ucs2_t *s,smb_ucs2_t c)
maxlength is in ucs2 units.
********************************************************************/
-smb_ucs2_t *alpha_strcpy_w(smb_ucs2_t *dest, const smb_ucs2_t *src, size_t maxlength)
+smb_ucs2_t *alpha_strcpy_w(smb_ucs2_t *dest, const smb_ucs2_t *src, const smb_ucs2_t *other_safe_chars, size_t maxlength)
{
size_t len, i;
+ smb_ucs2_t nullstr_w = (smb_ucs2_t)0;
if (!dest) {
DEBUG(0,("ERROR: NULL dest in alpha_strcpy_w\n"));
@@ -1471,9 +1472,12 @@ smb_ucs2_t *alpha_strcpy_w(smb_ucs2_t *dest, const smb_ucs2_t *src, size_t maxle
if (len >= maxlength)
len = maxlength - 1;
+ if (!other_safe_chars)
+ other_safe_chars = &nullstr_w;
+
for(i = 0; i < len; i++) {
smb_ucs2_t val = src[i];
- if(isupper_w(val) ||islower_w(val) || isdigit_w(val))
+ if(isupper_w(val) ||islower_w(val) || isdigit_w(val) || strchr_w(other_safe_chars, val))
dest[i] = src[i];
else
dest[i] = (smb_ucs2_t)'_';