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
8e9eb83c
Commit
8e9eb83c
authored
Feb 14, 2009
by
Jonathan Beck
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix Invalid memory read and match g_free with g_malloc.
parent
3c458d22
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
3 deletions
+3
-3
xplist.c
src/xplist.c
+3
-3
No files found.
src/xplist.c
View file @
8e9eb83c
...
...
@@ -59,12 +59,12 @@ static const char *plist_base = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n\
*
* @return The formatted string.
*/
static
char
*
format_string
(
const
char
*
buf
,
int
cols
,
int
depth
)
static
g
char
*
format_string
(
const
char
*
buf
,
int
cols
,
int
depth
)
{
int
colw
=
depth
+
cols
+
1
;
int
len
=
strlen
(
buf
);
int
nlines
=
len
/
cols
+
1
;
char
*
new_buf
=
(
char
*
)
malloc
(
nlines
*
colw
+
depth
+
1
);
gchar
*
new_buf
=
(
gchar
*
)
g_malloc0
(
nlines
*
colw
+
depth
+
1
);
int
i
=
0
;
int
j
=
0
;
...
...
@@ -76,7 +76,7 @@ static char *format_string(const char *buf, int cols, int depth)
new_buf
[
i
*
colw
]
=
'\n'
;
for
(
j
=
0
;
j
<
depth
;
j
++
)
new_buf
[
i
*
colw
+
1
+
j
]
=
'\t'
;
memcpy
(
new_buf
+
i
*
colw
+
1
+
depth
,
buf
+
i
*
cols
,
cols
);
memcpy
(
new_buf
+
i
*
colw
+
1
+
depth
,
buf
+
i
*
cols
,
(
i
+
1
)
*
cols
<=
len
?
cols
:
len
-
i
*
cols
);
}
new_buf
[
len
+
(
1
+
depth
)
*
nlines
]
=
'\n'
;
...
...
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