From: Kevin Wasserman Date: Fri, 11 May 2012 15:36:19 +0000 (-0400) Subject: MSLSA Don't use lstrcpy on ANSI strings X-Git-Tag: krb5-1.10.3-final~13 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=19b38c274bbf5bb2e566b434e14915ea2b141374;p=thirdparty%2Fkrb5.git MSLSA Don't use lstrcpy on ANSI strings Also change parameter types to eliminate casts. Signed-off-by: Kevin Wasserman (cherry picked from commit 7acb524f5aa00274771dbbfac19d2dd779aad409) ticket: 7212 version_fixed: 1.10.3 status: resolved --- diff --git a/src/lib/krb5/ccache/cc_mslsa.c b/src/lib/krb5/ccache/cc_mslsa.c index 098ba29c6b..3d579d6e8e 100644 --- a/src/lib/krb5/ccache/cc_mslsa.c +++ b/src/lib/krb5/ccache/cc_mslsa.c @@ -336,23 +336,15 @@ UnicodeToANSI(LPTSTR lpInputString, LPSTR lpszOutputString, int nOutStringLen) static VOID WINAPI -ANSIToUnicode(LPSTR lpInputString, LPTSTR lpszOutputString, int nOutStringLen) +ANSIToUnicode(LPCSTR lpInputString, LPWSTR lpszOutputString, int nOutStringLen) { CPINFO CodePageInfo; - lstrcpy(lpszOutputString, (LPTSTR) lpInputString); - GetCPInfo(CP_ACP, &CodePageInfo); - if (CodePageInfo.MaxCharSize > 1 || ((LPBYTE) lpInputString)[1] != '\0') - { - // Looks like ANSI or MultiByte, better translate it - MultiByteToWideChar(CP_ACP, 0, (LPCSTR) lpInputString, -1, - (LPWSTR) lpszOutputString, nOutStringLen); - } - else - lstrcpy(lpszOutputString, (LPTSTR) lpInputString); + MultiByteToWideChar(CP_ACP, 0, lpInputString, -1, + lpszOutputString, nOutStringLen); } // ANSIToUnicode