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
537b543d
Commit
537b543d
authored
6 years ago
by
Nikias Bassen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bplist: Remove redundant calls to strlen()
parent
74536d7a
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
7 deletions
+4
-7
bplist.c
src/bplist.c
+4
-7
No files found.
src/bplist.c
View file @
537b543d
...
...
@@ -1023,9 +1023,8 @@ static void write_data(bytearray_t * bplist, uint8_t * val, uint64_t size)
write_raw_data
(
bplist
,
BPLIST_DATA
,
val
,
size
);
}
static
void
write_string
(
bytearray_t
*
bplist
,
char
*
val
)
static
void
write_string
(
bytearray_t
*
bplist
,
char
*
val
,
uint64_t
size
)
{
uint64_t
size
=
strlen
(
val
);
write_raw_data
(
bplist
,
BPLIST_STRING
,
(
uint8_t
*
)
val
,
size
);
}
...
...
@@ -1188,7 +1187,6 @@ PLIST_API void plist_to_bin(plist_t plist, char **plist_bin, uint32_t * length)
uint64_t
*
offsets
=
NULL
;
bplist_trailer_t
trailer
;
//for string
long
len
=
0
;
long
items_read
=
0
;
long
items_written
=
0
;
uint16_t
*
unicodestr
=
NULL
;
...
...
@@ -1256,14 +1254,13 @@ PLIST_API void plist_to_bin(plist_t plist, char **plist_bin, uint32_t * length)
case
PLIST_KEY
:
case
PLIST_STRING
:
len
=
strlen
(
data
->
strval
);
if
(
is_ascii_string
(
data
->
strval
,
len
)
)
if
(
is_ascii_string
(
data
->
strval
,
data
->
length
)
)
{
write_string
(
bplist_buff
,
data
->
strval
);
write_string
(
bplist_buff
,
data
->
strval
,
data
->
length
);
}
else
{
unicodestr
=
plist_utf8_to_utf16
(
data
->
strval
,
len
,
&
items_read
,
&
items_written
);
unicodestr
=
plist_utf8_to_utf16
(
data
->
strval
,
data
->
length
,
&
items_read
,
&
items_written
);
write_unicode
(
bplist_buff
,
unicodestr
,
items_written
);
free
(
unicodestr
);
}
...
...
This diff is collapsed.
Click to expand it.
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