[PATCH] mfplat: Correctly caclulate length of schema

Alistair Leslie-Hughes leslie_alistair at hotmail.com
Wed Feb 23 00:44:35 CST 2022


When a url is passed in, for example "http://..."
We need to include the : in the scheme string not exclude it.

Signed-off-by: Alistair Leslie-Hughes <leslie_alistair at hotmail.com>
---
 dlls/mfplat/main.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/dlls/mfplat/main.c b/dlls/mfplat/main.c
index 7991152f7a7..0266bc197c8 100644
--- a/dlls/mfplat/main.c
+++ b/dlls/mfplat/main.c
@@ -6469,10 +6469,10 @@ static HRESULT resolver_get_scheme_handler(const WCHAR *url, DWORD flags, IMFSch
     if (ptr == url || *ptr != ':')
     {
         url = fileschemeW;
-        ptr = fileschemeW + ARRAY_SIZE(fileschemeW) - 1;
+        len = ARRAY_SIZE(fileschemeW);
     }
-
-    len = ptr - url;
+    else
+        len = ptr - url + 1;
     scheme = malloc((len + 1) * sizeof(WCHAR));
     if (!scheme)
         return E_OUTOFMEMORY;
-- 
2.34.1




More information about the wine-devel mailing list