[dlls/rsaenh/rsaenh.c] Strncpy elimination

Peter Berg Larsen pebl at math.ku.dk
Fri Apr 15 17:20:09 CDT 2005


Changelog:
	Strncpy elimination. Removes an strlen. Makes it clear
        that dwLen variable is not used.


Index: dlls/rsaenh/rsaenh.c
===================================================================
RCS file: /home/wine/wine/dlls/rsaenh/rsaenh.c,v
retrieving revision 1.25
diff -u -r1.25 rsaenh.c
--- dlls/rsaenh/rsaenh.c        28 Mar 2005 14:58:52 -0000      1.25
+++ dlls/rsaenh/rsaenh.c        15 Apr 2005 20:14:40 -0000
@@ -1399,21 +1399,19 @@
 BOOL WINAPI RSAENH_CPAcquireContext(HCRYPTPROV *phProv, LPSTR pszContainer,
                    DWORD dwFlags, PVTableProvStruc pVTable)
 {
-    DWORD dwLen;
     CHAR szKeyContainerName[MAX_PATH] = "";
     CHAR szRegKey[MAX_PATH];

     TRACE("(phProv=%p, pszContainer=%s, dwFlags=%08lx, pVTable=%p)\n", phProv,
           debugstr_a(pszContainer), dwFlags, pVTable);

-    if (pszContainer ? strlen(pszContainer) : 0)
+    if (pszContainer && *pszContainer)
     {
-        strncpy(szKeyContainerName, pszContainer, MAX_PATH);
-        szKeyContainerName[MAX_PATH-1] = '\0';
+        lstrcpynA(szKeyContainerName, pszContainer, MAX_PATH);
     }
     else
     {
-        dwLen = MAX_PATH;
+        DWORD dwLen = sizeof(szKeyContainerName);
         if (!GetUserNameA(szKeyContainerName, &dwLen)) return FALSE;
     }






More information about the wine-patches mailing list