summaryrefslogtreecommitdiff
path: root/source3/smbd/mangle.c
diff options
context:
space:
mode:
authorSimo Sorce <idra@samba.org>2001-10-28 19:19:57 +0000
committerSimo Sorce <idra@samba.org>2001-10-28 19:19:57 +0000
commit7433cb7c75591429cb6dcbe6fc50248d6dbfb359 (patch)
treed8532c0cda61be53ba819745e80bdbb95e1d6861 /source3/smbd/mangle.c
parent0374d57a4c601e4fd70d21e8cc751a91509f86bb (diff)
downloadsamba-7433cb7c75591429cb6dcbe6fc50248d6dbfb359.tar.gz
samba-7433cb7c75591429cb6dcbe6fc50248d6dbfb359.tar.bz2
samba-7433cb7c75591429cb6dcbe6fc50248d6dbfb359.zip
fix a logic bug on max size of a returned string,
this fixes also the bug with file renaming. (This used to be commit 5246d7609c3aff658fcd08a1f1c1bb6e11509e35)
Diffstat (limited to 'source3/smbd/mangle.c')
-rw-r--r--source3/smbd/mangle.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/source3/smbd/mangle.c b/source3/smbd/mangle.c
index 01297c89a7..d9843f2b42 100644
--- a/source3/smbd/mangle.c
+++ b/source3/smbd/mangle.c
@@ -1055,7 +1055,7 @@ static int ucs2_to_dos(char *dest, const smb_ucs2_t *src, int dest_len)
dest_len = sizeof(pstring);
}
- src_len = strlen_w(src) * sizeof(smb_ucs2_t);
+ src_len = strlen_w(src)* sizeof(smb_ucs2_t);
ret = convert_string(CH_UCS2, CH_DOS, src, src_len, dest, dest_len);
if (dest_len) dest[MIN(ret, dest_len-1)] = 0;
@@ -1554,7 +1554,13 @@ BOOL check_mangled_cache(char *s)
res = unmangle(u2);
if (res)
{
- ucs2_to_dos (s, res, 13); /* ugly, but must be done this way */
+
+ ucs2_to_dos (s, res, (strlen_w(res) * 2));
+ /* We MUST change this brainded interface,
+ we do not know how many chars will be used
+ in dos so i guess they will be no more than
+ double the size of the unicode string
+ ---simo */
DEBUG(10,("check_mangled_cache: returning -> [%s]\n", s));
ret = True;
}
@@ -1586,7 +1592,7 @@ void mangle_name_83(char *s)
res = _mangle(u2);
if (res) ucs2_to_dos (s, res, 13); /* ugly, but must be done this way */
- DEBUG(10,("mangle_name_83: returning -> [%s]\n", res?"True":"False"));
+ DEBUG(10,("mangle_name_83: returning -> [%s]\n", s));
SAFE_FREE(res);
SAFE_FREE(u2);
}