This fixes a null pointer dereference at least
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit cfda1bea4c18ec1edbc11ecc465f788b02851488)
Conflicts:
libavformat/hls.c
... | ... |
@@ -903,12 +903,16 @@ static void intercept_id3(struct playlist *pls, uint8_t *buf, |
903 | 903 |
|
904 | 904 |
static int check_url(const char *url) { |
905 | 905 |
const char *proto_name = avio_find_protocol_name(url); |
906 |
+ |
|
907 |
+ if (!proto_name) |
|
908 |
+ return AVERROR_INVALIDDATA; |
|
909 |
+ |
|
906 | 910 |
if (!av_strstart(proto_name, "http", NULL) && !av_strstart(proto_name, "file", NULL)) |
907 | 911 |
return AVERROR_INVALIDDATA; |
908 | 912 |
|
909 | 913 |
if (!strncmp(proto_name, url, strlen(proto_name)) && url[strlen(proto_name)] == ':') |
910 | 914 |
return 0; |
911 |
- else if (strcmp(proto_name, "file") || !strcmp(url, "file,")) |
|
915 |
+ else if (strcmp(proto_name, "file") || !strncmp(url, "file,", 5)) |
|
912 | 916 |
return AVERROR_INVALIDDATA; |
913 | 917 |
|
914 | 918 |
return 0; |