[dlls/reaenh/rsaenh.c] Strncpy elimination.
Peter Berg Larsen
pebl at math.ku.dk
Sun Mar 27 12:10:54 CST 2005
I have been checking the usage of strncpy, replacing where apropriate with
a memcpy or lstrcpyn[AW]. The first raw diff was 100kb, so there is bound
to be one or two slips. These are the first batch which I found to be
obvious, correct, and didnt need a special comment. Note with correct I
mean if there was a \0 bug before then it still there.
Changelog:
Janitorial Task: Check the usage of strncpy/strncpyW.
Index: dlls/rsaenh/rsaenh.c
===================================================================
RCS file: /home/wine/wine/dlls/rsaenh/rsaenh.c,v
retrieving revision 1.24
diff -u -r1.24 rsaenh.c
--- dlls/rsaenh/rsaenh.c 24 Mar 2005 21:01:37 -0000 1.24
+++ dlls/rsaenh/rsaenh.c 26 Mar 2005 09:41:09 -0000
@@ -959,15 +959,13 @@
destroy_key_container, (OBJECTHDR**)&pKeyContainer);
if (hKeyContainer != (HCRYPTPROV)INVALID_HANDLE_VALUE)
{
- strncpy(pKeyContainer->szName, pszContainerName, MAX_PATH);
- pKeyContainer->szName[MAX_PATH-1] = '\0';
+ lstrcpynA(pKeyContainer->szName, pszContainerName, MAX_PATH);
pKeyContainer->dwFlags = dwFlags;
pKeyContainer->dwEnumAlgsCtr = 0;
pKeyContainer->hKeyExchangeKeyPair = (HCRYPTKEY)INVALID_HANDLE_VALUE;
pKeyContainer->hSignatureKeyPair = (HCRYPTKEY)INVALID_HANDLE_VALUE;
if (pVTable && pVTable->pszProvName) {
- strncpy(pKeyContainer->szProvName, pVTable->pszProvName, MAX_PATH);
- pKeyContainer->szProvName[MAX_PATH-1] = '\0';
+ lstrcpynA(pKeyContainer->szProvName, pVTable->pszProvName, MAX_PATH);
if (!strcmp(pVTable->pszProvName, MS_DEF_PROV_A)) {
pKeyContainer->dwPersonality = RSAENH_PERSONALITY_BASE;
} else if (!strcmp(pVTable->pszProvName, MS_ENHANCED_PROV_A))
{
@@ -1410,8 +1408,7 @@
if (pszContainer ? strlen(pszContainer) : 0)
{
- strncpy(szKeyContainerName, pszContainer, MAX_PATH);
- szKeyContainerName[MAX_PATH-1] = '\0';
+ lstrcpynA(szKeyContainerName, pszContainer, MAX_PATH);
}
else
{
More information about the wine-patches
mailing list