]> git.ipfire.org Git - thirdparty/krb5.git/commitdiff
MSLSA Don't use lstrcpy on ANSI strings
authorKevin Wasserman <kevin.wasserman@painless-security.com>
Fri, 11 May 2012 15:36:19 +0000 (11:36 -0400)
committerSam Hartman <hartmans@mit.edu>
Mon, 16 Jul 2012 13:31:15 +0000 (09:31 -0400)
Also change parameter types to eliminate casts.

Signed-off-by: Kevin Wasserman <kevin.wasserman@painless-security.com>
ticket: 7212 (new)
tags: pullup

src/lib/krb5/ccache/cc_mslsa.c

index 098ba29c6b86e42e19e6a23f70dc43f846fda46c..3d579d6e8ef655dabb6586abb6d8635fde319868 100644 (file)
@@ -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