Module: wine Branch: master Commit: e1280919b8ac6dfc530351df60397365d16992f0 URL: http://source.winehq.org/git/wine.git/?a=commit;h=e1280919b8ac6dfc530351df60...
Author: Thomas Mullaly thomas.mullaly@gmail.com Date: Thu Sep 30 22:40:44 2010 -0400
urlmon: Restructured how the path component is validated in a IUriBuilder.
---
dlls/urlmon/uri.c | 38 +++++++++++++++++++++----------------- 1 files changed, 21 insertions(+), 17 deletions(-)
diff --git a/dlls/urlmon/uri.c b/dlls/urlmon/uri.c index 7aa62ca..04482e1 100644 --- a/dlls/urlmon/uri.c +++ b/dlls/urlmon/uri.c @@ -3734,8 +3734,11 @@ static void setup_port(const UriBuilder *builder, parse_data *data, DWORD flags)
static HRESULT validate_path(const UriBuilder *builder, parse_data *data, DWORD flags) { const WCHAR *ptr = NULL; + const WCHAR *component; const WCHAR **pptr; DWORD expected_len; + BOOL check_len = TRUE; + BOOL valid = FALSE;
if(builder->path) { ptr = builder->path; @@ -3744,29 +3747,30 @@ static HRESULT validate_path(const UriBuilder *builder, parse_data *data, DWORD builder->uri && builder->uri->path_start > -1) { ptr = builder->uri->canon_uri+builder->uri->path_start; expected_len = builder->uri->path_len; + } else { + static const WCHAR nullW[] = {0}; + ptr = nullW; + check_len = FALSE; }
- if(ptr) { - BOOL valid = FALSE; - const WCHAR *component = ptr; - pptr = &ptr; - - /* How the path is validated depends on what type of - * URI it is. - */ - valid = data->is_opaque ? - parse_path_opaque(pptr, data, flags) : parse_path_hierarchical(pptr, data, flags); + component = ptr; + pptr = &ptr;
- if(!valid || expected_len != data->path_len) { - TRACE("(%p %p %x): Invalid path componet %s.\n", builder, data, flags, - debugstr_wn(component, expected_len)); - return INET_E_INVALID_URL; - } + /* How the path is validated depends on what type of + * URI it is. + */ + valid = data->is_opaque ? + parse_path_opaque(pptr, data, flags) : parse_path_hierarchical(pptr, data, flags);
- TRACE("(%p %p %x): Valid path component %s len=%d.\n", builder, data, flags, - debugstr_wn(data->path, data->path_len), data->path_len); + if(!valid || (check_len && expected_len != data->path_len)) { + TRACE("(%p %p %x): Invalid path componet %s.\n", builder, data, flags, + debugstr_wn(component, expected_len)); + return INET_E_INVALID_URL; }
+ TRACE("(%p %p %x): Valid path component %s len=%d.\n", builder, data, flags, + debugstr_wn(data->path, data->path_len), data->path_len); + return S_OK; }