Commit bb0b4673 authored by Hans Leidekker's avatar Hans Leidekker Committed by Alexandre Julliard

msi: Avoid a null pointer dereference in MsiGetFileVersionW (clang).

parent bca0fd6a
...@@ -3201,18 +3201,18 @@ UINT WINAPI MsiGetFileVersionW( LPCWSTR path, LPWSTR verbuf, LPDWORD verlen, ...@@ -3201,18 +3201,18 @@ UINT WINAPI MsiGetFileVersionW( LPCWSTR path, LPWSTR verbuf, LPDWORD verlen,
return ERROR_INVALID_PARAMETER; return ERROR_INVALID_PARAMETER;
ret = get_file_version( path, verbuf, verlen, langbuf, langlen ); ret = get_file_version( path, verbuf, verlen, langbuf, langlen );
if (ret == ERROR_RESOURCE_DATA_NOT_FOUND) if (ret == ERROR_RESOURCE_DATA_NOT_FOUND && verlen)
{ {
int len; int len;
WCHAR *version = msi_font_version_from_file( path ); WCHAR *version = msi_font_version_from_file( path );
if (!version) return ERROR_FILE_INVALID; if (!version) return ERROR_FILE_INVALID;
len = strlenW( version ); len = strlenW( version );
if (*verlen > len) if (len >= *verlen) ret = ERROR_MORE_DATA;
else if (verbuf)
{ {
strcpyW( verbuf, version ); strcpyW( verbuf, version );
ret = ERROR_SUCCESS; ret = ERROR_SUCCESS;
} }
else ret = ERROR_MORE_DATA;
*verlen = len; *verlen = len;
msi_free( version ); msi_free( version );
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment