Index: cc_mslsa.c =================================================================== RCS file: /cvs/krbdev/krb5/src/lib/krb5/ccache/cc_mslsa.c,v retrieving revision 5.3.2.22 diff -u -r5.3.2.22 cc_mslsa.c --- cc_mslsa.c 2 Sep 2004 23:01:47 -0000 5.3.2.22 +++ cc_mslsa.c 2 Dec 2004 00:17:56 -0000 @@ -188,9 +188,19 @@ GetCPInfo(CP_ACP, &CodePageInfo); - if (CodePageInfo.MaxCharSize > 1) + if (CodePageInfo.MaxCharSize > 1) { // Only supporting non-Unicode strings - return FALSE; + int reqLen = WideCharToMultiByte(CP_ACP, 0, (LPCWSTR) lpInputString, -1, + NULL, 0, NULL, NULL); + + if ( reqLen > nOutStringLen) + { + return FALSE; + } else { + WideCharToMultiByte(CP_ACP, 0, (LPCWSTR) lpInputString, -1, + lpszOutputString, nOutStringLen, NULL, NULL); + } + } else if (((LPBYTE) lpInputString)[1] == '\0') { // Looks like unicode, better translate it @@ -199,12 +209,13 @@ } else lstrcpyA(lpszOutputString, (LPSTR) lpInputString); + return TRUE; } // UnicodeToANSI static VOID WINAPI -ANSIToUnicode(LPSTR lpInputString, LPTSTR lpszOutputString, int nOutStringLen) +ANSIToUnicode(LPSTR lpInputString, LPTSTR lpszOutputString, int nOutStringLen) { CPINFO CodePageInfo; @@ -213,12 +224,9 @@ GetCPInfo(CP_ACP, &CodePageInfo); - if (CodePageInfo.MaxCharSize > 1) - // It must already be a Unicode string - return; - else if (((LPBYTE) lpInputString)[1] != '\0') + if (CodePageInfo.MaxCharSize > 1 || ((LPBYTE) lpInputString)[1] != '\0') { - // Looks like ANSI, better translate it + // Looks like ANSI or MultiByte, better translate it MultiByteToWideChar(CP_ACP, 0, (LPCSTR) lpInputString, -1, (LPWSTR) lpszOutputString, nOutStringLen); }