Module: wine Branch: master Commit: d90aca35c4d3e0d4d5cebaeae3a8628fb9d62767 URL: http://source.winehq.org/git/wine.git/?a=commit;h=d90aca35c4d3e0d4d5cebaeae3... Author: James Hawkins <truiken(a)gmail.com> Date: Mon Dec 7 19:55:32 2009 -0800 msi: Add a NULL terminator to file->dest after reallocation. --- dlls/msi/action.c | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-) diff --git a/dlls/msi/action.c b/dlls/msi/action.c index 0755f42..ef30dda 100644 --- a/dlls/msi/action.c +++ b/dlls/msi/action.c @@ -5288,6 +5288,11 @@ static BOOL move_files_wildcard(LPWSTR source, LPWSTR dest, int options) goto done; } + /* file->dest may be shorter after the reallocation, so add a NULL + * terminator. This is needed for the call to strrchrW, as there will no + * longer be a NULL terminator within the bounds of the allocation in this case. + */ + file->dest[size - 1] = '\0'; lstrcpyW(strrchrW(file->dest, '\\') + 1, file->destname); while (!list_empty(&files.entry))