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
11138293
Commit
11138293
authored
Sep 01, 2015
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
sdp: fix potential read overflow and get rid of info.i_pos
parent
fbf85e3d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
7 deletions
+12
-7
modules/access/sdp.c
modules/access/sdp.c
+12
-7
No files found.
modules/access/sdp.c
View file @
11138293
...
...
@@ -46,6 +46,7 @@ static int Control (access_t *, int, va_list);
struct
access_sys_t
{
size_t
offset
;
size_t
length
;
char
data
[];
};
...
...
@@ -60,6 +61,7 @@ static int Open (vlc_object_t *obj)
return
VLC_ENOMEM
;
/* NOTE: This copy is not really needed. Better safe than sorry. */
sys
->
offset
=
0
;
sys
->
length
=
len
;
memcpy
(
sys
->
data
,
access
->
psz_location
,
len
);
...
...
@@ -85,22 +87,26 @@ static ssize_t Read (access_t *access, uint8_t *buf, size_t len)
{
access_sys_t
*
sys
=
access
->
p_sys
;
if
(
access
->
info
.
i_pos
>=
sys
->
length
)
if
(
sys
->
offset
>=
sys
->
length
)
{
access
->
info
.
b_eof
=
true
;
return
0
;
}
if
(
len
>
sys
->
length
)
len
=
sys
->
length
;
memcpy
(
buf
,
sys
->
data
+
access
->
info
.
i_pos
,
len
);
access
->
info
.
i_pos
+=
len
;
if
(
len
>
sys
->
length
-
sys
->
offset
)
len
=
sys
->
length
-
sys
->
offset
;
memcpy
(
buf
,
sys
->
data
+
sys
->
offset
,
len
);
return
len
;
}
static
int
Seek
(
access_t
*
access
,
uint64_t
position
)
{
access
->
info
.
i_pos
=
position
;
access_sys_t
*
sys
=
access
->
p_sys
;
if
(
position
>
sys
->
length
)
position
=
sys
->
length
;
sys
->
offset
=
position
;
access
->
info
.
b_eof
=
false
;
return
VLC_SUCCESS
;
}
...
...
@@ -135,6 +141,5 @@ static int Control (access_t *access, int query, va_list args)
case
ACCESS_SET_PAUSE_STATE
:
return
VLC_SUCCESS
;
}
(
void
)
access
;
return
VLC_EGENERIC
;
}
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