Commit c5f5039b authored by Jean-Paul Saman's avatar Jean-Paul Saman

stream_filter/httplive.c: do not crash on strdup(NULL)

httplive crashed in parse_SegmentInformation on line 428. The cause is
that hls->url.psz_path can be NULL, when there is no meta playlist involved.
In that situation it results in a crash of vlc. (Issue reported by Felix Kuehne.)
parent 36f82683
...@@ -383,6 +383,9 @@ static char *relative_URI(stream_t *s, const char *uri, const char *path) ...@@ -383,6 +383,9 @@ static char *relative_URI(stream_t *s, const char *uri, const char *path)
if (p != NULL) if (p != NULL)
return NULL; return NULL;
if (p_sys->m3u8.psz_path == NULL)
return NULL;
char *psz_path = strdup(p_sys->m3u8.psz_path); char *psz_path = strdup(p_sys->m3u8.psz_path);
if (psz_path == NULL) return NULL; if (psz_path == NULL) return NULL;
p = strrchr(psz_path, '/'); p = strrchr(psz_path, '/');
...@@ -425,14 +428,18 @@ static void parse_SegmentInformation(stream_t *s, hls_stream_t *hls, char *p_rea ...@@ -425,14 +428,18 @@ static void parse_SegmentInformation(stream_t *s, hls_stream_t *hls, char *p_rea
return; return;
} }
char *psz_path = strdup(hls->url.psz_path); char *psz_path = NULL;
if (psz_path == NULL) if (hls->url.psz_path != NULL)
{ {
p_sys->b_error = true; char *psz_path = strdup(hls->url.psz_path);
return; if (psz_path == NULL)
{
p_sys->b_error = true;
return;
}
char *p = strrchr(psz_path, '/');
if (p) *p = '\0';
} }
char *p = strrchr(psz_path, '/');
if (p) *p = '\0';
char *psz_uri = relative_URI(s, uri, psz_path); char *psz_uri = relative_URI(s, uri, psz_path);
free(psz_path); free(psz_path);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment