summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2004-03-08 21:54:54 +0000
committerJeremy Allison <jra@samba.org>2004-03-08 21:54:54 +0000
commit3f14e8eb9dd9893ed195853dd7cf46ee5c2d5133 (patch)
treeface2748be43465b880be1173aa266bf115daec7 /source3
parentb3b93aaa3f3aee9bc48edea4c00613b5f8fe9f73 (diff)
downloadsamba-3f14e8eb9dd9893ed195853dd7cf46ee5c2d5133.tar.gz
samba-3f14e8eb9dd9893ed195853dd7cf46ee5c2d5133.tar.bz2
samba-3f14e8eb9dd9893ed195853dd7cf46ee5c2d5133.zip
Fix assumption about following directory sep in check_path_syntax(). We
need to try and convert 1 byte, then 2 bytes if that fails. Fixes bug reported by Simo. Jeremy. (This used to be commit 8702d0089619c7321b93e59d35f43ef32dce7b78)
Diffstat (limited to 'source3')
-rw-r--r--source3/smbd/reply.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/source3/smbd/reply.c b/source3/smbd/reply.c
index c0d5234f47..1ff969493e 100644
--- a/source3/smbd/reply.c
+++ b/source3/smbd/reply.c
@@ -114,14 +114,20 @@ static NTSTATUS check_path_syntax(pstring destname, const pstring srcname)
/*
* Potential mb char with second char a directory separator.
* All the encodings we care about are 2 byte only, so do a
- * conversion to unicode. If the 2 byte char won't convert then
- * it's probably a one byte char with a real directory separator
- * following, so only copy one byte. If it will convert then
- * copy both bytes.
+ * conversion to unicode. If the one byte char converts then
+ * it really is a directory separator following. Otherwise if
+ * the two byte character converts (and it should or our assumption
+ * about character sets is broken and we panic) then copy both
+ * bytes as it's a MB character, not a directory separator.
*/
+
uint16 ucs2_val;
- if (convert_string(CH_UNIX, CH_UCS2, s, 2, &ucs2_val, 2) == 2) {
+ if (convert_string(CH_UNIX, CH_UCS2, s, 1, &ucs2_val, 2) == 2) {
+ ;
+ } else if (convert_string(CH_UNIX, CH_UCS2, s, 2, &ucs2_val, 2) == 2) {
*d++ = *s++;
+ } else {
+ smb_panic("check_path_syntax: directory separator assumptions invalid !\n");
}
}
/* Just copy the char (or the second byte of the mb char). */