Module: wine Branch: master Commit: 1e1084232d8d95540fbd7196c948ee4f8b5532b2 URL: http://source.winehq.org/git/wine.git/?a=commit;h=1e1084232d8d95540fbd7196c9...
Author: Nikolay Sivov nsivov@codeweavers.com Date: Wed Jan 1 22:00:40 2014 +0400
ntdll: Fix manifest attribute parsing.
---
dlls/kernel32/tests/actctx.c | 12 ++++++++++++ dlls/ntdll/actctx.c | 12 +++++++++++- 2 files changed, 23 insertions(+), 1 deletions(-)
diff --git a/dlls/kernel32/tests/actctx.c b/dlls/kernel32/tests/actctx.c index ab655c0..5795e18 100644 --- a/dlls/kernel32/tests/actctx.c +++ b/dlls/kernel32/tests/actctx.c @@ -74,6 +74,11 @@ static const char manifest1[] = "<assemblyIdentity version="1.0.0.0" name="Wine.Test" type="win32"></assemblyIdentity>" "</assembly>";
+static const char manifest1_1[] = +"<assembly xmlns = "urn:schemas-microsoft-com:asm.v1" manifestVersion = "1.0">" +"<assemblyIdentity version = "1.0.0.0" name = "Wine.Test" type = "win32"></assemblyIdentity>" +"</assembly>"; + static const char manifest2[] = "<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">" "<assemblyIdentity version="1.2.3.4" name="Wine.Test" type="win32">" @@ -1748,6 +1753,13 @@ static void test_actctx(void) pReleaseActCtx(handle); }
+ /* test for whitespace handling in Eq ::= S? '=' S? */ + create_manifest_file("test1_1.manifest", manifest1_1, -1, NULL, NULL); + handle = test_create("test1_1.manifest"); + ok(handle != INVALID_HANDLE_VALUE, "got %p\n", handle); + DeleteFileA("test1_1.manifest"); + pReleaseActCtx(handle); + if(!create_manifest_file("test1.manifest", manifest1, -1, NULL, NULL)) { skip("Could not create manifest file\n"); return; diff --git a/dlls/ntdll/actctx.c b/dlls/ntdll/actctx.c index 962a4e5..bdbb330 100644 --- a/dlls/ntdll/actctx.c +++ b/dlls/ntdll/actctx.c @@ -1125,13 +1125,23 @@ static BOOL next_xml_attr(xmlbuf_t* xmlbuf, xmlstr_t* name, xmlstr_t* value, ptr = xmlbuf->ptr; while (ptr < xmlbuf->end && *ptr != '=' && *ptr != '>' && !isxmlspace(*ptr)) ptr++;
- if (ptr == xmlbuf->end || *ptr != '=') return FALSE; + if (ptr == xmlbuf->end) return FALSE;
name->ptr = xmlbuf->ptr; name->len = ptr-xmlbuf->ptr; xmlbuf->ptr = ptr;
+ /* skip spaces before '=' */ + while (ptr < xmlbuf->end && *ptr != '=' && isxmlspace(*ptr)) ptr++; + if (ptr == xmlbuf->end || *ptr != '=') return FALSE; + + /* skip '=' itself */ ptr++; + if (ptr == xmlbuf->end) return FALSE; + + /* skip spaces after '=' */ + while (ptr < xmlbuf->end && *ptr != '"' && *ptr != ''' && isxmlspace(*ptr)) ptr++; + if (ptr == xmlbuf->end || (*ptr != '"' && *ptr != ''')) return FALSE;
value->ptr = ++ptr;