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
e2de299b
Commit
e2de299b
authored
Aug 13, 2014
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
subtitles: avoid VLA over untrusted input and variable shadowing
parent
63e775d5
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
11 deletions
+9
-11
src/input/subtitles.c
src/input/subtitles.c
+9
-11
No files found.
src/input/subtitles.c
View file @
e2de299b
...
...
@@ -357,28 +357,26 @@ char **subtitles_Detect( input_thread_t *p_this, char *psz_path,
}
if
(
i_prio
>=
i_fuzzy
)
{
char
psz_path
[
strlen
(
psz_dir
)
+
strlen
(
psz_name
)
+
2
];
struct
stat
st
;
char
*
path
;
sprintf
(
psz_path
,
"%s"
DIR_SEP
"%s"
,
psz_dir
,
psz_name
);
if
(
!
strcmp
(
psz_path
,
psz_fname
)
)
if
(
asprintf
(
&
path
,
"%s"
DIR_SEP
"%s"
,
psz_dir
,
psz_name
)
<
0
)
continue
;
if
(
!
vlc_stat
(
psz_path
,
&
st
)
&&
S_ISREG
(
st
.
st_mode
)
&&
result
)
if
(
strcmp
(
path
,
psz_fname
)
&&
vlc_stat
(
path
,
&
st
)
==
0
&&
S_ISREG
(
st
.
st_mode
)
&&
result
)
{
msg_Dbg
(
p_this
,
"autodetected subtitle: %s with priority %d"
,
p
sz_p
ath
,
i_prio
);
path
,
i_prio
);
result
[
i_sub_count
].
priority
=
i_prio
;
result
[
i_sub_count
].
psz_fname
=
strdup
(
psz_path
);
result
[
i_sub_count
].
psz_fname
=
path
;
path
=
NULL
;
result
[
i_sub_count
].
psz_ext
=
strdup
(
tmp_fname_ext
);
i_sub_count
++
;
}
else
{
msg_Dbg
(
p_this
,
"stat failed (autodetecting subtitle: %s with priority %d)"
,
psz_path
,
i_prio
);
}
free
(
path
);
}
}
closedir
(
dir
);
...
...
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