This fixes a null pointer dereference at least
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit cfda1bea4c18ec1edbc11ecc465f788b02851488)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
... | ... |
@@ -619,12 +619,16 @@ static int open_url(HLSContext *c, URLContext **uc, const char *url, AVDictionar |
619 | 619 |
AVDictionary *tmp = NULL; |
620 | 620 |
int ret; |
621 | 621 |
const char *proto_name = avio_find_protocol_name(url); |
622 |
+ |
|
623 |
+ if (!proto_name) |
|
624 |
+ return AVERROR_INVALIDDATA; |
|
625 |
+ |
|
622 | 626 |
// only http(s) & file are allowed |
623 | 627 |
if (!av_strstart(proto_name, "http", NULL) && !av_strstart(proto_name, "file", NULL)) |
624 | 628 |
return AVERROR_INVALIDDATA; |
625 | 629 |
if (!strncmp(proto_name, url, strlen(proto_name)) && url[strlen(proto_name)] == ':') |
626 | 630 |
; |
627 |
- else if (strcmp(proto_name, "file") || !strcmp(url, "file,")) |
|
631 |
+ else if (strcmp(proto_name, "file") || !strncmp(url, "file,", 5)) |
|
628 | 632 |
return AVERROR_INVALIDDATA; |
629 | 633 |
|
630 | 634 |
av_dict_copy(&tmp, c->avio_opts, 0); |