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
2a514976
Commit
2a514976
authored
Dec 13, 2008
by
Jonathan Beck
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix node length while parsing XML.
parent
3f0dfcf5
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
4 deletions
+9
-4
plist.c
src/plist.c
+3
-4
xplist.c
src/xplist.c
+6
-0
No files found.
src/plist.c
View file @
2a514976
...
...
@@ -75,7 +75,7 @@ plist_t plist_new_array()
plist_t
plist_add_sub_element
(
plist_t
node
,
plist_type
type
,
void
*
value
,
uint64_t
length
)
{
//only structured types are allowed to have nulll value
if
(
!
value
&&
(
type
==
PLIST_DICT
||
type
==
PLIST_ARRAY
))
{
if
(
value
||
(
!
value
&&
(
type
==
PLIST_DICT
||
type
==
PLIST_ARRAY
)
))
{
//now handle value
plist_data_t
data
=
plist_new_plist_data
();
data
->
type
=
type
;
...
...
@@ -91,6 +91,7 @@ plist_t plist_add_sub_element(plist_t node, plist_type type, void *value, uint64
case
PLIST_REAL
:
data
->
realval
=
*
((
double
*
)
value
);
break
;
case
PLIST_KEY
:
case
PLIST_STRING
:
data
->
strval
=
strdup
((
char
*
)
value
);
break
;
...
...
@@ -209,15 +210,13 @@ void plist_get_type_and_value(plist_t node, plist_type * type, void *value, uint
case
PLIST_REAL
:
*
((
double
*
)
value
)
=
data
->
realval
;
break
;
case
PLIST_KEY
:
case
PLIST_STRING
:
*
((
char
**
)
value
)
=
strdup
(
data
->
strval
);
break
;
case
PLIST_UNICODE
:
*
((
wchar_t
**
)
value
)
=
wcsdup
(
data
->
unicodeval
);
break
;
case
PLIST_KEY
:
*
((
char
**
)
value
)
=
strdup
(
data
->
strval
);
break
;
case
PLIST_DATA
:
case
PLIST_ARRAY
:
case
PLIST_DICT
:
...
...
src/xplist.c
View file @
2a514976
...
...
@@ -230,12 +230,14 @@ void xml_to_node(xmlNodePtr xml_node, plist_t * plist_node)
if
(
!
xmlStrcmp
(
node
->
name
,
"true"
))
{
data
->
boolval
=
1
;
data
->
type
=
PLIST_BOOLEAN
;
data
->
length
=
1
;
continue
;
}
if
(
!
xmlStrcmp
(
node
->
name
,
"false"
))
{
data
->
boolval
=
0
;
data
->
type
=
PLIST_BOOLEAN
;
data
->
length
=
1
;
continue
;
}
...
...
@@ -243,6 +245,7 @@ void xml_to_node(xmlNodePtr xml_node, plist_t * plist_node)
char
*
strval
=
xmlNodeGetContent
(
node
);
data
->
intval
=
g_ascii_strtoull
(
strval
,
NULL
,
0
);
data
->
type
=
PLIST_UINT
;
data
->
length
=
8
;
continue
;
}
...
...
@@ -250,6 +253,7 @@ void xml_to_node(xmlNodePtr xml_node, plist_t * plist_node)
char
*
strval
=
xmlNodeGetContent
(
node
);
data
->
realval
=
atof
(
strval
);
data
->
type
=
PLIST_REAL
;
data
->
length
=
8
;
continue
;
}
...
...
@@ -259,12 +263,14 @@ void xml_to_node(xmlNodePtr xml_node, plist_t * plist_node)
if
(
!
xmlStrcmp
(
node
->
name
,
"string"
))
{
data
->
strval
=
strdup
(
xmlNodeGetContent
(
node
));
data
->
type
=
PLIST_STRING
;
data
->
length
=
strlen
(
data
->
strval
);
continue
;
}
if
(
!
xmlStrcmp
(
node
->
name
,
"key"
))
{
data
->
strval
=
strdup
(
xmlNodeGetContent
(
node
));
data
->
type
=
PLIST_KEY
;
data
->
length
=
strlen
(
data
->
strval
);
continue
;
}
...
...
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