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
e140a280
Commit
e140a280
authored
Mar 07, 2016
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
archive/iso9660: check path buffer bounds
parent
de61c3b9
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
4 deletions
+13
-4
NEWS
NEWS
+2
-0
Iso9660ArchivePlugin.cxx
src/archive/plugins/Iso9660ArchivePlugin.cxx
+11
-4
No files found.
NEWS
View file @
e140a280
...
...
@@ -2,6 +2,8 @@ ver 0.19.14 (not yet released)
* decoder
- dsdiff: fix off-by-one buffer overflow
- opus: limit tag size to 64 kB
* archive
- iso9660: fix buffer overflow
* fix build failures on non-glibc builds due to constexpr Mutex
ver 0.19.13 (2016/02/23)
...
...
src/archive/plugins/Iso9660ArchivePlugin.cxx
View file @
e140a280
...
...
@@ -66,7 +66,10 @@ public:
return
iso9660_iso_seek_read
(
iso
,
ptr
,
start
,
i_size
);
}
void
Visit
(
char
*
path
,
size_t
length
,
/**
* @param capacity the path buffer size
*/
void
Visit
(
char
*
path
,
size_t
length
,
size_t
capacity
,
ArchiveVisitor
&
visitor
);
virtual
void
Close
()
override
{
...
...
@@ -85,7 +88,7 @@ static constexpr Domain iso9660_domain("iso9660");
/* archive open && listing routine */
inline
void
Iso9660ArchiveFile
::
Visit
(
char
*
path
,
size_t
length
,
Iso9660ArchiveFile
::
Visit
(
char
*
path
,
size_t
length
,
size_t
capacity
,
ArchiveVisitor
&
visitor
)
{
auto
*
entlist
=
iso9660_ifs_readdir
(
iso
,
path
);
...
...
@@ -102,12 +105,16 @@ Iso9660ArchiveFile::Visit(char *path, size_t length,
continue
;
size_t
filename_length
=
strlen
(
filename
);
if
(
length
+
filename_length
+
1
>=
capacity
)
/* file name is too long */
continue
;
memcpy
(
path
+
length
,
filename
,
filename_length
+
1
);
size_t
new_length
=
length
+
filename_length
;
if
(
iso9660_stat_s
::
_STAT_DIR
==
statbuf
->
type
)
{
memcpy
(
path
+
new_length
,
"/"
,
2
);
Visit
(
path
,
new_length
+
1
,
visitor
);
Visit
(
path
,
new_length
+
1
,
capacity
,
visitor
);
}
else
{
//remove leading /
visitor
.
VisitArchiveEntry
(
path
+
1
);
...
...
@@ -135,7 +142,7 @@ void
Iso9660ArchiveFile
::
Visit
(
ArchiveVisitor
&
visitor
)
{
char
path
[
4096
]
=
"/"
;
Visit
(
path
,
1
,
visitor
);
Visit
(
path
,
1
,
sizeof
(
path
),
visitor
);
}
/* single archive handling */
...
...
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