[PATCH] msvcrt: replaced bad memcpy by strcpy (Coverity)
Marcus Meissner
marcus at jet.franken.de
Sun Oct 16 17:42:28 CDT 2011
Hi,
The sizeof() here took a sizeof(char*), as sizeof() is evaluated
during compile time and does not look into the strings.
This worked fine for 32bit, as "XXX" and \0 is 4 bytes == sizeof(char*),
but is breaking for 64bit.
Just use strcpy().
CID 3789
Ciao, Marcus
---
dlls/msvcrt/locale.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/dlls/msvcrt/locale.c b/dlls/msvcrt/locale.c
index 6733522..c64e3d9 100644
--- a/dlls/msvcrt/locale.c
+++ b/dlls/msvcrt/locale.c
@@ -102,7 +102,7 @@ static void remap_synonym(char *name)
if (!strcasecmp(_country_synonyms[i],name))
{
TRACE(":Mapping synonym %s to %s\n",name,_country_synonyms[i+1]);
- memcpy(name, _country_synonyms[i+1], sizeof(_country_synonyms[i+1]));
+ strcpy(name, _country_synonyms[i+1]);
return;
}
}
--
1.7.3.4
More information about the wine-patches
mailing list