Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
13ef81e4
Commit
13ef81e4
authored
Jun 21, 2016
by
Hans Leidekker
Committed by
Alexandre Julliard
Jun 22, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
webservices: Validate parent nodes in the writer.
Signed-off-by:
Hans Leidekker
<
hans@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
b0077f06
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
13 additions
and
10 deletions
+13
-10
reader.c
dlls/webservices/reader.c
+5
-6
webservices_private.h
dlls/webservices/webservices_private.h
+1
-0
writer.c
dlls/webservices/writer.c
+7
-4
No files found.
dlls/webservices/reader.c
View file @
13ef81e4
...
...
@@ -1100,9 +1100,8 @@ static inline BOOL is_valid_parent( const struct node *node )
return
node_type
(
node
)
==
WS_XML_NODE_TYPE_ELEMENT
||
node_type
(
node
)
==
WS_XML_NODE_TYPE_BOF
;
}
st
atic
struct
node
*
read_find_parent
(
struct
reader
*
reader
)
st
ruct
node
*
find_parent
(
struct
node
*
node
)
{
struct
node
*
node
=
reader
->
current
;
if
(
node_type
(
node
)
==
WS_XML_NODE_TYPE_END_ELEMENT
)
{
if
(
!
node
->
parent
||
!
is_valid_parent
(
node
->
parent
->
parent
))
return
NULL
;
...
...
@@ -1168,7 +1167,7 @@ static HRESULT read_element( struct reader *reader )
}
if
(
!
len
)
goto
error
;
if
(
!
(
parent
=
read_find_parent
(
reader
)))
goto
error
;
if
(
!
(
parent
=
find_parent
(
reader
->
current
)))
goto
error
;
hr
=
E_OUTOFMEMORY
;
if
(
!
(
node
=
alloc_node
(
WS_XML_NODE_TYPE_ELEMENT
)))
goto
error
;
...
...
@@ -1217,7 +1216,7 @@ static HRESULT read_text( struct reader *reader )
len
+=
skip
;
}
if
(
!
(
parent
=
read_find_parent
(
reader
)))
return
WS_E_INVALID_FORMAT
;
if
(
!
(
parent
=
find_parent
(
reader
->
current
)))
return
WS_E_INVALID_FORMAT
;
if
(
!
(
node
=
alloc_node
(
WS_XML_NODE_TYPE_TEXT
)))
return
E_OUTOFMEMORY
;
text
=
(
WS_XML_TEXT_NODE
*
)
node
;
...
...
@@ -1386,7 +1385,7 @@ static HRESULT read_comment( struct reader *reader )
len
+=
skip
;
}
if
(
!
(
parent
=
read_find_parent
(
reader
)))
return
WS_E_INVALID_FORMAT
;
if
(
!
(
parent
=
find_parent
(
reader
->
current
)))
return
WS_E_INVALID_FORMAT
;
if
(
!
(
node
=
alloc_node
(
WS_XML_NODE_TYPE_COMMENT
)))
return
E_OUTOFMEMORY
;
comment
=
(
WS_XML_COMMENT_NODE
*
)
node
;
...
...
@@ -1410,7 +1409,7 @@ static HRESULT read_startcdata( struct reader *reader )
if
(
read_cmp
(
reader
,
"<![CDATA["
,
9
))
return
WS_E_INVALID_FORMAT
;
read_skip
(
reader
,
9
);
if
(
!
(
parent
=
read_find_parent
(
reader
)))
return
WS_E_INVALID_FORMAT
;
if
(
!
(
parent
=
find_parent
(
reader
->
current
)))
return
WS_E_INVALID_FORMAT
;
if
(
!
(
node
=
alloc_node
(
WS_XML_NODE_TYPE_CDATA
)))
return
E_OUTOFMEMORY
;
read_insert_node
(
reader
,
parent
,
node
);
...
...
dlls/webservices/webservices_private.h
View file @
13ef81e4
...
...
@@ -45,6 +45,7 @@ struct node
struct
node
*
alloc_node
(
WS_XML_NODE_TYPE
)
DECLSPEC_HIDDEN
;
void
free_node
(
struct
node
*
)
DECLSPEC_HIDDEN
;
void
destroy_nodes
(
struct
node
*
)
DECLSPEC_HIDDEN
;
struct
node
*
find_parent
(
struct
node
*
)
DECLSPEC_HIDDEN
;
static
inline
WS_XML_NODE_TYPE
node_type
(
const
struct
node
*
node
)
{
...
...
dlls/webservices/writer.c
View file @
13ef81e4
...
...
@@ -880,10 +880,11 @@ static HRESULT write_flush( struct writer *writer )
static
HRESULT
write_add_element_node
(
struct
writer
*
writer
,
const
WS_XML_STRING
*
prefix
,
const
WS_XML_STRING
*
localname
,
const
WS_XML_STRING
*
ns
)
{
struct
node
*
node
;
struct
node
*
node
,
*
parent
;
WS_XML_ELEMENT_NODE
*
elem
;
HRESULT
hr
;
if
(
!
(
parent
=
find_parent
(
writer
->
current
)))
return
WS_E_INVALID_FORMAT
;
if
((
hr
=
write_flush
(
writer
))
!=
S_OK
)
return
hr
;
if
(
!
prefix
&&
node_type
(
writer
->
current
)
==
WS_XML_NODE_TYPE_ELEMENT
)
...
...
@@ -907,7 +908,7 @@ static HRESULT write_add_element_node( struct writer *writer, const WS_XML_STRIN
free_node
(
node
);
return
E_OUTOFMEMORY
;
}
write_insert_node
(
writer
,
writer
->
cur
rent
,
node
);
write_insert_node
(
writer
,
pa
rent
,
node
);
writer
->
state
=
WRITER_STATE_STARTELEMENT
;
return
S_OK
;
}
...
...
@@ -938,14 +939,16 @@ static inline void write_set_attribute_value( struct writer *writer, WS_XML_TEXT
static
HRESULT
write_add_text_node
(
struct
writer
*
writer
,
WS_XML_TEXT
*
value
)
{
struct
node
*
node
;
struct
node
*
node
,
*
parent
;
WS_XML_TEXT_NODE
*
text
;
if
(
!
(
parent
=
find_parent
(
writer
->
current
)))
return
WS_E_INVALID_FORMAT
;
if
(
!
(
node
=
alloc_node
(
WS_XML_NODE_TYPE_TEXT
)))
return
E_OUTOFMEMORY
;
text
=
(
WS_XML_TEXT_NODE
*
)
node
;
text
->
text
=
value
;
write_insert_node
(
writer
,
writer
->
cur
rent
,
node
);
write_insert_node
(
writer
,
pa
rent
,
node
);
writer
->
state
=
WRITER_STATE_TEXT
;
return
S_OK
;
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment