summaryrefslogtreecommitdiff
path: root/source3/smbd
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2011-03-30 13:08:31 -0700
committerJeremy Allison <jra@samba.org>2011-03-30 23:59:37 +0200
commitc109a70531de72eef30a695248b91704bd0c7c24 (patch)
tree29182afa1ae334e8aee0e71e59aa1a0e5de65f6a /source3/smbd
parent9ede19fdccaf09303012208129a093197403ef2c (diff)
downloadsamba-c109a70531de72eef30a695248b91704bd0c7c24.tar.gz
samba-c109a70531de72eef30a695248b91704bd0c7c24.tar.bz2
samba-c109a70531de72eef30a695248b91704bd0c7c24.zip
Fix convert_string() to take a *converted_size arg. and return a bool.
Makes these interfaces much harder to misuse and easier to ensure error checking. Autobuild-User: Jeremy Allison <jra@samba.org> Autobuild-Date: Wed Mar 30 23:59:37 CEST 2011 on sn-devel-104
Diffstat (limited to 'source3/smbd')
-rw-r--r--source3/smbd/mangle_hash2.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/source3/smbd/mangle_hash2.c b/source3/smbd/mangle_hash2.c
index 367c21688a..a39bb895c2 100644
--- a/source3/smbd/mangle_hash2.c
+++ b/source3/smbd/mangle_hash2.c
@@ -627,6 +627,7 @@ static bool is_legal_name(const char *name)
if (((unsigned int)name[0]) > 128 && (name[1] != 0)) {
/* Possible start of mb character. */
char mbc[2];
+ size_t size = 0;
/*
* Note that if CH_UNIX is utf8 a string may be 3
* bytes, but this is ok as mb utf8 characters don't
@@ -634,10 +635,12 @@ static bool is_legal_name(const char *name)
* for mb UNIX asian characters like Japanese (SJIS) here.
* JRA.
*/
- if (convert_string(CH_UNIX, CH_UTF16LE, name, 2, mbc, 2) == 2) {
- /* Was a good mb string. */
- name += 2;
- continue;
+ if (convert_string(CH_UNIX, CH_UTF16LE, name, 2, mbc, 2, &size)) {
+ if (size == 2) {
+ /* Was a good mb string. */
+ name += 2;
+ continue;
+ }
}
}