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
6558f6e8
Commit
6558f6e8
authored
Dec 17, 2015
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
https: validate that content range is what we want
parent
5e2f165d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
5 deletions
+27
-5
modules/access/http/file.c
modules/access/http/file.c
+27
-5
No files found.
modules/access/http/file.c
View file @
6558f6e8
...
@@ -22,6 +22,8 @@
...
@@ -22,6 +22,8 @@
# include <config.h>
# include <config.h>
#endif
#endif
#include <assert.h>
#include <errno.h>
#include <stdbool.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdint.h>
#include <stdio.h>
#include <stdio.h>
...
@@ -129,11 +131,32 @@ static struct vlc_http_msg *vlc_http_file_open(struct vlc_http_file *file,
...
@@ -129,11 +131,32 @@ static struct vlc_http_msg *vlc_http_file_open(struct vlc_http_file *file,
int
status
=
vlc_http_msg_get_status
(
resp
);
int
status
=
vlc_http_msg_get_status
(
resp
);
if
(
status
<
200
||
status
>=
599
)
if
(
status
<
200
||
status
>=
599
)
goto
fail
;
if
(
status
==
206
)
{
{
vlc_http_msg_destroy
(
resp
);
const
char
*
str
=
vlc_http_msg_get_header
(
resp
,
"Content-Range"
);
resp
=
NULL
;
if
(
str
==
NULL
)
{
/* A multipart/byteranges response. This is not what we asked for
* and we do not support it. */
errno
=
EINVAL
;
goto
fail
;
}
uintmax_t
start
,
end
;
if
(
sscanf
(
str
,
"bytes %ju-%ju"
,
&
start
,
&
end
)
!=
2
||
start
!=
offset
||
start
>
end
)
{
/* A single range response is what we asked for, but not at that
* start offset. */
errno
=
EINVAL
;
goto
fail
;
}
}
}
return
resp
;
return
resp
;
fail:
vlc_http_msg_destroy
(
resp
);
return
NULL
;
}
}
void
vlc_http_file_destroy
(
struct
vlc_http_file
*
file
)
void
vlc_http_file_destroy
(
struct
vlc_http_file
*
file
)
...
@@ -273,8 +296,7 @@ uintmax_t vlc_http_file_get_size(struct vlc_http_file *file)
...
@@ -273,8 +296,7 @@ uintmax_t vlc_http_file_get_size(struct vlc_http_file *file)
if
(
status
==
206
/* Partial Content */
)
if
(
status
==
206
/* Partial Content */
)
{
/* IETF RFC7233 §4.1 */
{
/* IETF RFC7233 §4.1 */
if
(
range
==
NULL
)
assert
(
range
!=
NULL
);
/* checked by vlc_http_file_open() */
return
-
1
;
/* invalid response */
uintmax_t
end
,
total
;
uintmax_t
end
,
total
;
...
@@ -287,7 +309,7 @@ uintmax_t vlc_http_file_get_size(struct vlc_http_file *file)
...
@@ -287,7 +309,7 @@ uintmax_t vlc_http_file_get_size(struct vlc_http_file *file)
case
2
:
case
2
:
return
total
;
return
total
;
}
}
return
-
1
;
vlc_assert_unreachable
();
/* checked by vlc_http_file_open() */
}
}
if
(
status
==
416
/* Range Not Satisfiable */
)
if
(
status
==
416
/* Range Not Satisfiable */
)
...
...
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