]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
r4032: Fix bug #2110 - ensure we convert to ucs2 correctly.
authorJeremy Allison <jra@samba.org>
Thu, 2 Dec 2004 00:55:47 +0000 (00:55 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 15:53:30 +0000 (10:53 -0500)
Jeremy.

source/lib/ms_fnmatch.c
source/lib/util_unistr.c

index 3040dc7f9d350f5dbfaccf787bcb8b4e5507448b..71f3959c2416cd5d3c45065843173ffff776aeab 100644 (file)
@@ -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) {
                /*
index bfb5288826ff58aa044395146c4fa084810d0f4e..997dde91c22e988e1267c6f38593203f6906400f 100644 (file)
@@ -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++; }