aboutsummaryrefslogtreecommitdiff
path: root/video_player/src
diff options
context:
space:
mode:
Diffstat (limited to 'video_player/src')
-rw-r--r--video_player/src/main.cpp16
1 files changed, 12 insertions, 4 deletions
diff --git a/video_player/src/main.cpp b/video_player/src/main.cpp
index 4ec9278..e166e85 100644
--- a/video_player/src/main.cpp
+++ b/video_player/src/main.cpp
@@ -449,25 +449,33 @@ static int64_t size_fn(void *cookie) {
if(res == 0) {
size_t header_start = str_find_case_insensitive(buffer, 0, "200 OK", 6);
- if(header_start == std::string::npos)
+ if(header_start == std::string::npos) {
+ res = MPV_ERROR_UNSUPPORTED;
goto end;
+ }
header_start += 6;
size_t content_length_index = str_find_case_insensitive(buffer, header_start, "content-length:", 15);
- if(content_length_index == std::string::npos)
+ if(content_length_index == std::string::npos) {
+ res = MPV_ERROR_UNSUPPORTED;
goto end;
+ }
content_length_index += 15;
size_t content_length_end = buffer.find('\r', content_length_index);
- if(content_length_end == std::string::npos)
+ if(content_length_end == std::string::npos) {
+ res = MPV_ERROR_UNSUPPORTED;
goto end;
+ }
buffer[content_length_end] = '\0';
errno = 0;
char *endptr;
int64_t content_length = strtoll(&buffer[content_length_index], &endptr, 10);
- if(endptr == &buffer[content_length_index] || errno != 0)
+ if(endptr == &buffer[content_length_index] || errno != 0) {
+ res = MPV_ERROR_UNSUPPORTED;
goto end;
+ }
res = content_length;
}