From 1e1084232d8d95540fbd7196c948ee4f8b5532b2 Mon Sep 17 00:00:00 2001 From: Nikolay Sivov Date: Wed, 1 Jan 2014 22:00:40 +0400 Subject: [PATCH] ntdll: Fix manifest attribute parsing. --- dlls/kernel32/tests/actctx.c | 12 ++++++++++++ dlls/ntdll/actctx.c | 12 +++++++++++- 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/dlls/kernel32/tests/actctx.c b/dlls/kernel32/tests/actctx.c index ab655c0cc8b..5795e187fd7 100644 --- a/dlls/kernel32/tests/actctx.c +++ b/dlls/kernel32/tests/actctx.c @@ -74,6 +74,11 @@ static const char manifest1[] = "" ""; +static const char manifest1_1[] = +"" +"" +""; + static const char manifest2[] = "" "" @@ -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 962a4e54c9c..bdbb330634b 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;