Fixed possible buffer overflow bug in unused WinWStrDupFromChar function (Patch #271)

git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@6781 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
anders_k 2016-08-21 12:00:00 +00:00
parent 3b8afc2e89
commit 765d245758
2 changed files with 11 additions and 1 deletions

View file

@ -46,7 +46,7 @@ int WinWStrNICmpASCII(const WINWCHAR *a, const char *b, size_t n)
WINWCHAR* WinWStrDupFromChar(const char *s, unsigned int cp)
{
int cch = MultiByteToWideChar(cp, 0, s, -1, 0, 0);
wchar_t *p = (wchar_t*) malloc(cch);
wchar_t *p = (wchar_t*) malloc(cch * sizeof(wchar_t));
if (p)
{
MultiByteToWideChar(cp, 0, s, -1, p, cch);