Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
L
libplist
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
1
Issues
1
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
pwn
libplist
Commits
950b6ddc
Commit
950b6ddc
authored
Nov 27, 2016
by
Nikias Bassen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
plist_copy: Duplicate hash tables when copying PLIST_DICT nodes
parent
75140cb9
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
5 deletions
+15
-5
plist.c
src/plist.c
+15
-5
No files found.
src/plist.c
View file @
950b6ddc
...
...
@@ -325,10 +325,7 @@ static void plist_copy_node(node_t *node, void *parent_node_ptr)
memcpy
(
newdata
,
data
,
sizeof
(
struct
plist_data_s
));
node_type
=
plist_get_node_type
(
node
);
if
(
node_type
==
PLIST_DATA
||
node_type
==
PLIST_STRING
||
node_type
==
PLIST_KEY
)
{
switch
(
node_type
)
{
switch
(
node_type
)
{
case
PLIST_DATA
:
newdata
->
buff
=
(
uint8_t
*
)
malloc
(
data
->
length
);
memcpy
(
newdata
->
buff
,
data
->
buff
,
data
->
length
);
...
...
@@ -337,9 +334,22 @@ static void plist_copy_node(node_t *node, void *parent_node_ptr)
case
PLIST_STRING
:
newdata
->
strval
=
strdup
((
char
*
)
data
->
strval
);
break
;
case
PLIST_DICT
:
if
(
data
->
hashtable
)
{
hashtable_t
*
ht
=
hash_table_new
(
dict_key_hash
,
dict_key_compare
,
NULL
);
assert
(
ht
);
plist_t
current
=
NULL
;
for
(
current
=
(
plist_t
)
node_first_child
(
node
);
ht
&&
current
;
current
=
(
plist_t
)
node_next_sibling
(
node_next_sibling
(
current
)))
{
hash_table_insert
(
ht
,
((
node_t
*
)
current
)
->
data
,
node_next_sibling
(
current
));
}
newdata
->
hashtable
=
ht
;
}
break
;
default:
break
;
}
}
newnode
=
plist_new_node
(
newdata
);
...
...
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