crypt32: Don't copy past end of buffer when removing a string from a multi string.

This commit is contained in:
Juan Lang 2009-11-29 11:42:57 -08:00 committed by Alexandre Julliard
parent 916e38f969
commit f2040b7725
1 changed files with 4 additions and 2 deletions

View File

@ -881,9 +881,11 @@ static BOOL CRYPT_RemoveStringFromMultiString(LPWSTR multi, LPCWSTR toRemove)
} }
else else
{ {
LPCWSTR nextStr = spotToRemove + lstrlenW(toRemove) + 1;
/* Copy remainder of string "left" */ /* Copy remainder of string "left" */
memmove(spotToRemove, spotToRemove + lstrlenW(toRemove) + 1, memmove(spotToRemove, nextStr,
(len - (spotToRemove - multi)) * sizeof(WCHAR)); (len - (nextStr - multi)) * sizeof(WCHAR));
} }
ret = TRUE; ret = TRUE;
} }