Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
videolan
vlc
Commits
f8fde191
Commit
f8fde191
authored
Aug 18, 2014
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bluray: fix ToCToU between stat() and realpath()
parent
17390c6f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
7 deletions
+9
-7
modules/access/bluray.c
modules/access/bluray.c
+9
-7
No files found.
modules/access/bluray.c
View file @
f8fde191
...
...
@@ -229,16 +229,17 @@ static void FindMountPoint(char **file)
{
char
*
device
=
*
file
;
#if defined (HAVE_MNTENT_H) && defined (HAVE_SYS_STAT_H)
/* bd path may be a symlink (e.g. /dev/dvd -> /dev/sr0), so make sure
* we look up the real device */
char
*
bd_device
=
realpath
(
device
,
NULL
);
if
(
bd_device
==
NULL
)
return
;
struct
stat
st
;
if
(
!
stat
(
device
,
&
st
)
&&
S_ISBLK
(
st
.
st_mode
))
{
if
(
lstat
(
bd_device
,
&
st
)
==
0
&&
S_ISBLK
(
st
.
st_mode
))
{
FILE
*
mtab
=
setmntent
(
"/proc/self/mounts"
,
"r"
);
struct
mntent
*
m
,
mbuf
;
char
buf
[
8192
];
/* bd path may be a symlink (e.g. /dev/dvd -> /dev/sr0), so make
* sure we look up the real device */
char
*
bd_device
=
realpath
(
device
,
NULL
);
if
(
!
bd_device
)
bd_device
=
strdup
(
device
);
while
((
m
=
getmntent_r
(
mtab
,
&
mbuf
,
buf
,
sizeof
(
buf
)))
!=
NULL
)
{
if
(
!
strcmp
(
m
->
mnt_fsname
,
bd_device
))
{
...
...
@@ -247,9 +248,10 @@ static void FindMountPoint(char **file)
break
;
}
}
free
(
bd_device
);
endmntent
(
mtab
);
}
free
(
bd_device
);
#elif defined(__APPLE__)
struct
stat
st
;
if
(
!
stat
(
device
,
&
st
)
&&
S_ISBLK
(
st
.
st_mode
))
{
...
...
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