urlmon: Fix incorrect pointer arithmetic (too conversative) in map_url_to_zone. (RESEND^2)
Gerald Pfeifer
gerald at pfeifer.com
Fri Jun 17 00:42:46 CDT 2011
A friendly soul pointed out to me that I had missed three(!) responses
to my patch which went to wine-devel at . Sorry about that, I'll see to
set up some mail filters to prevent that from happening.
For the record, somehow I got mislead re the semantics of sizeof, and
that after some 25 years of programming C. :-(
Sorry!
Gerald
On Wed, 15 Jun 2011, Gerald Pfeifer wrote:
> Anything wrong with this patch? The original code surely looks wrong?
>
> The difference between two pointers (of the same type) is the number
> of elements, not the number of bytes. Thus the code below was way
> incorrect, luckily only too conversative.
>
> Gerald
>
> ---
> dlls/urlmon/sec_mgr.c | 2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/dlls/urlmon/sec_mgr.c b/dlls/urlmon/sec_mgr.c
> index 7b4bb35..75850ee 100644
> --- a/dlls/urlmon/sec_mgr.c
> +++ b/dlls/urlmon/sec_mgr.c
> @@ -529,7 +529,7 @@ static HRESULT map_url_to_zone(LPCWSTR url, DWORD *zone, LPWSTR *ret_url)
> hres = CoInternetParseUrl(secur_url, PARSE_PATH_FROM_URL, 0, path,
> sizeof(path)/sizeof(WCHAR), &size, 0);
>
> - if(SUCCEEDED(hres) && (ptr = strchrW(path, '\\')) && ptr-path < sizeof(root)/sizeof(WCHAR)) {
> + if(SUCCEEDED(hres) && (ptr = strchrW(path, '\\')) && ptr-path < sizeof(root)) {
> UINT type;
>
> memcpy(root, path, (ptr-path)*sizeof(WCHAR));
>
More information about the wine-devel
mailing list