Commit e1280919 authored by Thomas Mullaly's avatar Thomas Mullaly Committed by Alexandre Julliard

urlmon: Restructured how the path component is validated in a IUriBuilder.

parent d8263344
......@@ -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;
}
......
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