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
babec330
Commit
babec330
authored
Jan 21, 2010
by
Jonathan Beck
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix some warnings
parent
874942ec
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
15 additions
and
52 deletions
+15
-52
plutil.c
plutil/plutil.c
+5
-4
bplist.c
src/bplist.c
+2
-3
plist.c
src/plist.c
+2
-34
xplist.c
src/xplist.c
+2
-1
plist_cmp.c
test/plist_cmp.c
+1
-6
plist_test.c
test/plist_test.c
+3
-4
No files found.
plutil/plutil.c
View file @
babec330
...
...
@@ -38,7 +38,8 @@ int main(int argc, char *argv[])
FILE
*
iplist
=
NULL
;
plist_t
root_node
=
NULL
;
char
*
plist_out
=
NULL
;
int
size
=
0
;
uint32_t
size
=
0
;
int
read_size
=
0
;
char
*
plist_entire
=
NULL
;
struct
stat
*
filestats
=
(
struct
stat
*
)
malloc
(
sizeof
(
struct
stat
));
Options
*
options
=
parse_arguments
(
argc
,
argv
);
...
...
@@ -55,7 +56,7 @@ int main(int argc, char *argv[])
return
1
;
stat
(
options
->
in_file
,
filestats
);
plist_entire
=
(
char
*
)
malloc
(
sizeof
(
char
)
*
(
filestats
->
st_size
+
1
));
fread
(
plist_entire
,
sizeof
(
char
),
filestats
->
st_size
,
iplist
);
read_size
=
fread
(
plist_entire
,
sizeof
(
char
),
filestats
->
st_size
,
iplist
);
fclose
(
iplist
);
...
...
@@ -64,12 +65,12 @@ int main(int argc, char *argv[])
if
(
memcmp
(
plist_entire
,
"bplist00"
,
8
)
==
0
)
{
plist_from_bin
(
plist_entire
,
filestats
->
st
_size
,
&
root_node
);
plist_from_bin
(
plist_entire
,
read
_size
,
&
root_node
);
plist_to_xml
(
root_node
,
&
plist_out
,
&
size
);
}
else
{
plist_from_xml
(
plist_entire
,
filestats
->
st
_size
,
&
root_node
);
plist_from_xml
(
plist_entire
,
read
_size
,
&
root_node
);
plist_to_bin
(
root_node
,
&
plist_out
,
&
size
);
}
plist_free
(
root_node
);
...
...
src/bplist.c
View file @
babec330
...
...
@@ -82,7 +82,7 @@ static void byte_convert(uint8_t * address, size_t size)
static
uint32_t
uint24_from_be
(
char
*
buff
)
{
uint32_t
ret
=
0
;
char
*
tmp
=
(
char
*
)
&
ret
;
uint8_t
*
tmp
=
(
uint8_t
*
)
&
ret
;
memcpy
(
tmp
+
1
,
buff
,
3
*
sizeof
(
char
));
byte_convert
(
tmp
,
sizeof
(
uint32_t
));
return
ret
;
...
...
@@ -192,7 +192,6 @@ static plist_t parse_unicode_node(char *bnode, uint64_t size)
uint64_t
i
=
0
;
gunichar2
*
unicodestr
=
NULL
;
gchar
*
tmpstr
=
NULL
;
int
type
=
0
;
glong
items_read
=
0
;
glong
items_written
=
0
;
GError
*
error
=
NULL
;
...
...
@@ -858,7 +857,7 @@ void plist_to_bin(plist_t plist, char **plist_bin, uint32_t * length)
case
PLIST_KEY
:
case
PLIST_STRING
:
len
=
strlen
(
data
->
strval
);
type
=
xmlDetectCharEncoding
(
data
->
strval
,
len
);
type
=
xmlDetectCharEncoding
(
(
const
unsigned
char
*
)
data
->
strval
,
len
);
if
(
XML_CHAR_ENCODING_UTF8
==
type
)
{
unicodestr
=
g_utf8_to_utf16
(
data
->
strval
,
len
,
&
items_read
,
&
items_written
,
&
error
);
...
...
src/plist.c
View file @
babec330
...
...
@@ -414,38 +414,6 @@ void plist_dict_remove_item(plist_t node, const char* key)
return
;
}
static
char
compare_node_value
(
plist_type
type
,
plist_data_t
data
,
const
void
*
value
,
uint64_t
length
)
{
char
res
=
FALSE
;
switch
(
type
)
{
case
PLIST_BOOLEAN
:
res
=
data
->
boolval
==
*
((
char
*
)
value
)
?
TRUE
:
FALSE
;
break
;
case
PLIST_UINT
:
res
=
data
->
intval
==
*
((
uint64_t
*
)
value
)
?
TRUE
:
FALSE
;
break
;
case
PLIST_REAL
:
res
=
data
->
realval
==
*
((
double
*
)
value
)
?
TRUE
:
FALSE
;
break
;
case
PLIST_KEY
:
case
PLIST_STRING
:
res
=
!
strcmp
(
data
->
strval
,
((
char
*
)
value
));
break
;
case
PLIST_DATA
:
res
=
!
memcmp
(
data
->
buff
,
(
char
*
)
value
,
length
);
break
;
case
PLIST_DATE
:
res
=
!
memcmp
(
&
(
data
->
timeval
),
value
,
sizeof
(
GTimeVal
));
break
;
case
PLIST_ARRAY
:
case
PLIST_DICT
:
default:
break
;
}
return
res
;
}
plist_t
plist_access_pathv
(
plist_t
plist
,
uint32_t
length
,
va_list
v
)
{
plist_t
current
=
plist
;
...
...
@@ -458,8 +426,8 @@ plist_t plist_access_pathv(plist_t plist, uint32_t length, va_list v)
if
(
type
==
PLIST_ARRAY
)
{
uint32_t
index
=
va_arg
(
v
,
uint32_t
);
current
=
plist_array_get_item
(
current
,
index
);
uint32_t
n
=
va_arg
(
v
,
uint32_t
);
current
=
plist_array_get_item
(
current
,
n
);
}
else
if
(
type
==
PLIST_DICT
)
{
...
...
src/xplist.c
View file @
babec330
...
...
@@ -25,6 +25,7 @@
#include <stdlib.h>
#include <stdio.h>
#include <inttypes.h>
#include <libxml/parser.h>
#include <libxml/tree.h>
...
...
@@ -149,7 +150,7 @@ static void node_to_xml(GNode * node, gpointer xml_struct)
case
PLIST_UINT
:
tag
=
XPLIST_INT
;
val
=
g_strdup_printf
(
"%
llu"
,
node_data
->
intval
);
val
=
g_strdup_printf
(
"%
"
PRIu64
,
node_data
->
intval
);
break
;
case
PLIST_REAL
:
...
...
test/plist_cmp.c
View file @
babec330
...
...
@@ -43,12 +43,7 @@ static plist_t plist_get_next_sibling(plist_t node)
return
(
plist_t
)
g_node_next_sibling
((
GNode
*
)
node
);
}
static
plist_t
plist_get_prev_sibling
(
plist_t
node
)
{
return
(
plist_t
)
g_node_prev_sibling
((
GNode
*
)
node
);
}
char
compare_plist
(
plist_t
node_l
,
plist_t
node_r
)
static
char
compare_plist
(
plist_t
node_l
,
plist_t
node_r
)
{
plist_t
cur_l
=
NULL
;
plist_t
cur_r
=
NULL
;
...
...
test/plist_test.c
View file @
babec330
...
...
@@ -35,15 +35,14 @@
int
main
(
int
argc
,
char
*
argv
[])
{
FILE
*
iplist
=
NULL
;
FILE
*
oplist
=
NULL
;
plist_t
root_node1
=
NULL
;
plist_t
root_node2
=
NULL
;
char
*
plist_xml
=
NULL
;
char
*
plist_xml2
=
NULL
;
char
*
plist_bin
=
NULL
;
int
size_in
=
0
;
in
t
size_out
=
0
;
in
t
size_out2
=
0
;
uint32_
t
size_out
=
0
;
uint32_
t
size_out2
=
0
;
char
*
file_in
=
NULL
;
struct
stat
*
filestats
=
(
struct
stat
*
)
malloc
(
sizeof
(
struct
stat
));
if
(
argc
!=
2
)
...
...
@@ -123,7 +122,7 @@ int main(int argc, char *argv[])
free
(
plist_xml2
);
free
(
filestats
);
if
(
size_in
!=
size_out2
)
if
(
(
uint32_t
)
size_in
!=
size_out2
)
{
printf
(
"Size of input and output is different
\n
"
);
printf
(
"Input size : %i
\n
"
,
size_in
);
...
...
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