[vlc-devel] [PATCH] hds: Base URL should not include a possible query

Tristan Matthews le.businessman at gmail.com
Thu Jul 31 21:58:34 CEST 2014


On Wed, Jul 30, 2014 at 11:47 AM, Antti Ajanki <antti.ajanki at iki.fi> wrote:
> ---
>  modules/stream_filter/hds/hds.c |   12 ++++++++----
>  1 file changed, 8 insertions(+), 4 deletions(-)
>
> diff --git a/modules/stream_filter/hds/hds.c b/modules/stream_filter/hds/hds.c
> index ae75994..3e39535 100644
> --- a/modules/stream_filter/hds/hds.c
> +++ b/modules/stream_filter/hds/hds.c
> @@ -24,6 +24,8 @@
>  # include "config.h"
>  #endif
>
> +#include <limits.h> /* INT_MAX */
> +
>  #include <vlc_common.h>
>  #include <vlc_plugin.h>
>  #include <vlc_stream.h>
> @@ -1411,17 +1413,19 @@ static int Open( vlc_object_t *p_this )
>      if( unlikely( p_sys == NULL ) )
>          return VLC_ENOMEM;
>
> -    char *uri = NULL;
> -    if( unlikely( asprintf( &uri, "%s://%s", s->psz_access, s->psz_path ) < 0 ) )
> +    char *uri_without_query = NULL;
> +    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 );
>          return VLC_ENOMEM;
>      }
>
>      /* remove the last part of the url */
> -    char *pos = strrchr( uri, '/');
> +    char *pos = strrchr( uri_without_query, '/');
>      *pos = '\0';
> -    p_sys->base_url = uri;
> +    p_sys->base_url = uri_without_query;
>
>      p_sys->flv_header_bytes_sent = 0;
>
> --
> 1.7.10.4
>
> _______________________________________________
> vlc-devel mailing list
> To unsubscribe or modify your subscription options:
> https://mailman.videolan.org/listinfo/vlc-devel

Merged (with whitespace fix), thanks.

Best,
Tristan



More information about the vlc-devel mailing list