Commit c1b3c201 authored by Antti Ajanki's avatar Antti Ajanki Committed by Tristan Matthews

hds: Base URL should not include a possible query

parent ae192018
...@@ -24,6 +24,8 @@ ...@@ -24,6 +24,8 @@
# include "config.h" # include "config.h"
#endif #endif
#include <limits.h> /* INT_MAX */
#include <vlc_common.h> #include <vlc_common.h>
#include <vlc_plugin.h> #include <vlc_plugin.h>
#include <vlc_stream.h> #include <vlc_stream.h>
...@@ -1411,17 +1413,20 @@ static int Open( vlc_object_t *p_this ) ...@@ -1411,17 +1413,20 @@ static int Open( vlc_object_t *p_this )
if( unlikely( p_sys == NULL ) ) if( unlikely( p_sys == NULL ) )
return VLC_ENOMEM; return VLC_ENOMEM;
char *uri = NULL; char *uri_without_query = NULL;
if( unlikely( asprintf( &uri, "%s://%s", s->psz_access, s->psz_path ) < 0 ) ) size_t pathlen = strcspn( s->psz_path, "?" );
if( unlikely( ( pathlen > INT_MAX ) ||
( asprintf( &uri_without_query, "%s://%.*s", s->psz_access,
(int)pathlen, s->psz_path ) < 0 ) ) )
{ {
free( p_sys ); free( p_sys );
return VLC_ENOMEM; return VLC_ENOMEM;
} }
/* remove the last part of the url */ /* remove the last part of the url */
char *pos = strrchr( uri, '/'); char *pos = strrchr( uri_without_query, '/');
*pos = '\0'; *pos = '\0';
p_sys->base_url = uri; p_sys->base_url = uri_without_query;
p_sys->flv_header_bytes_sent = 0; p_sys->flv_header_bytes_sent = 0;
......
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