Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mpd
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Иван Мажукин
mpd
Commits
27535a7f
Commit
27535a7f
authored
Sep 03, 2012
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update_walk: fix unsafe readlink() usage
parent
acaa7254
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
2 deletions
+11
-2
NEWS
NEWS
+1
-0
update_walk.c
src/update_walk.c
+10
-2
No files found.
NEWS
View file @
27535a7f
...
...
@@ -17,6 +17,7 @@ ver 0.17.2 (2012/??/??)
* playlist: fix memory leak
* state_file: save song priorities
* player: disable cross-fading in "single" mode
* update: fix unsafe readlink() usage
ver 0.17.1 (2012/07/31)
...
...
src/update_walk.c
View file @
27535a7f
...
...
@@ -283,12 +283,20 @@ skip_symlink(const struct directory *directory, const char *utf8_name)
return
true
;
char
buffer
[
MPD_PATH_MAX
];
ssize_t
ret
=
readlink
(
path_fs
,
buffer
,
sizeof
(
buffer
));
ssize_t
length
=
readlink
(
path_fs
,
buffer
,
sizeof
(
buffer
));
g_free
(
path_fs
);
if
(
ret
<
0
)
if
(
length
<
0
)
/* don't skip if this is not a symlink */
return
errno
!=
EINVAL
;
if
((
size_t
)
length
>=
sizeof
(
buffer
))
/* skip symlinks when the buffer is too small for the
link target */
return
true
;
/* null-terminate the buffer, because readlink() will not */
buffer
[
length
]
=
0
;
if
(
!
follow_inside_symlinks
&&
!
follow_outside_symlinks
)
{
/* ignore all symlinks */
return
true
;
...
...
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