summaryrefslogtreecommitdiffstats
path: root/source/lib
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2004-12-02 00:55:47 +0000
committerJeremy Allison <jra@samba.org>2004-12-02 00:55:47 +0000
commitf9520dabdad1517673bc7285760810bd2eca7ec0 (patch)
treebe54a13f072f21b1e1ab207f74e304a4ee237bac /source/lib
parentcac439b13206aa09fb5ac8bb89165af092ccfaa2 (diff)
downloadsamba-f9520dabdad1517673bc7285760810bd2eca7ec0.tar.gz
samba-f9520dabdad1517673bc7285760810bd2eca7ec0.tar.xz
samba-f9520dabdad1517673bc7285760810bd2eca7ec0.zip
r4032: Fix bug #2110 - ensure we convert to ucs2 correctly.
Jeremy.
Diffstat (limited to 'source/lib')
-rw-r--r--source/lib/ms_fnmatch.c13
-rw-r--r--source/lib/util_unistr.c10
2 files changed, 11 insertions, 12 deletions
diff --git a/source/lib/ms_fnmatch.c b/source/lib/ms_fnmatch.c
index 3040dc7f9d3..71f3959c241 100644
--- a/source/lib/ms_fnmatch.c
+++ b/source/lib/ms_fnmatch.c
@@ -167,8 +167,17 @@ int ms_fnmatch(const char *pattern, const char *string, enum protocol_types prot
}
}
- pstrcpy_wa(p, pattern);
- pstrcpy_wa(s, string);
+ if (push_ucs2(NULL, p, pattern, sizeof(p), STR_TERMINATE) == (size_t)-1) {
+ /* Not quite the right answer, but finding the right one
+ under this failure case is expensive, and it's pretty close */
+ return -1;
+ }
+
+ if (push_ucs2(NULL, s, string, sizeof(s), STR_TERMINATE) == (size_t)-1) {
+ /* Not quite the right answer, but finding the right one
+ under this failure case is expensive, and it's pretty close */
+ return -1;
+ }
if (protocol <= PROTOCOL_LANMAN2) {
/*
diff --git a/source/lib/util_unistr.c b/source/lib/util_unistr.c
index bfb5288826f..997dde91c22 100644
--- a/source/lib/util_unistr.c
+++ b/source/lib/util_unistr.c
@@ -708,16 +708,6 @@ BOOL trim_string_w(smb_ucs2_t *s, const smb_ucs2_t *front,
The char* arguments must NOT be multibyte - to be completely sure
of this only pass string constants */
-
-void pstrcpy_wa(smb_ucs2_t *dest, const char *src)
-{
- int i;
- for (i=0;i<PSTRING_LEN;i++) {
- dest[i] = UCS2_CHAR(src[i]);
- if (src[i] == 0) return;
- }
-}
-
int strcmp_wa(const smb_ucs2_t *a, const char *b)
{
while (*b && *a == UCS2_CHAR(*b)) { a++; b++; }