X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=activex%2Futils.cpp;h=8cb0b0e08a6ba212e800e2947419d5caefb4afa1;hb=165585bded2fe25f1afc25b6d342205ae8c19753;hp=8750aa1ce2e6749e3e3b9492829a4d2dd58b975f;hpb=a99f23a0c9f80840ae5ce4011fa10a82a638289e;p=vlc diff --git a/activex/utils.cpp b/activex/utils.cpp index 8750aa1ce2..8cb0b0e08a 100644 --- a/activex/utils.cpp +++ b/activex/utils.cpp @@ -181,22 +181,32 @@ LPWSTR CombineURL(LPCWSTR baseUrl, LPCWSTR url) { // validate protocol header const wchar_t *start = url; - while( start != end ) { - wchar_t c = towlower(*start); - if( (c < L'a') || (c > L'z') ) - // not a valid protocol header, assume relative URL - goto relativeurl; - ++start; - } - /* we have a protocol header, therefore URL is absolute */ - UINT len = wcslen(url); - wchar_t *href = (LPWSTR)CoTaskMemAlloc((len+1)*sizeof(wchar_t)); - if( href ) + wchar_t c = *start; + if( iswalpha(c) ) { - memcpy(href, url, len*sizeof(wchar_t)); - href[len] = L'\0'; + ++start; + while( start != end ) + { + c = *start; + if( ! (iswalnum(c) + || (L'-' == c) + || (L'+' == c) + || (L'.' == c) + || (L'/' == c)) ) /* VLC uses / to allow user to specify a demuxer */ + // not valid protocol header, assume relative URL + goto relativeurl; + ++start; + } + /* we have a protocol header, therefore URL is absolute */ + UINT len = wcslen(url); + wchar_t *href = (LPWSTR)CoTaskMemAlloc((len+1)*sizeof(wchar_t)); + if( href ) + { + memcpy(href, url, len*sizeof(wchar_t)); + href[len] = L'\0'; + } + return href; } - return href; } relativeurl: