From d7a1c4f79c7c9d7038096a34626ba7236e856929 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Thu, 2 Dec 2004 00:55:47 +0000 Subject: r4032: Fix bug #2110 - ensure we convert to ucs2 correctly. Jeremy. (This used to be commit a1e5a2a6ab1abc9add7a606e2e3f2d6c88dcf96c) --- source3/lib/ms_fnmatch.c | 13 +++++++++++-- source3/lib/util_unistr.c | 10 ---------- 2 files changed, 11 insertions(+), 12 deletions(-) diff --git a/source3/lib/ms_fnmatch.c b/source3/lib/ms_fnmatch.c index 3040dc7f9d..71f3959c24 100644 --- a/source3/lib/ms_fnmatch.c +++ b/source3/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/source3/lib/util_unistr.c b/source3/lib/util_unistr.c index bfb5288826..997dde91c2 100644 --- a/source3/lib/util_unistr.c +++ b/source3/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