[FFmpeg-devel] [PATCH] libavformat/utils.c: Fixed URL parsing

Paul B Mahol onemda at gmail.com
Wed Feb 12 20:22:20 EET 2020


On 2/12/20, gautamramk at gmail.com <gautamramk at gmail.com> wrote:
> From: Gautam Ramakrishnan <gautamramk at gmail.com>
>
> This commit fixes bug #8466 wherein URLs with query string
> not preceeded by the '/' symbol in a URL was failing to get
> parsed. The av_url_split() function now checks if the path
> starts with a '/' and prepends it if it does not.
> ---
>  libavformat/utils.c | 7 +++++++
>  1 file changed, 7 insertions(+)
>
> diff --git a/libavformat/utils.c b/libavformat/utils.c
> index 81ea239a66..a14d4ef90d 100644
> --- a/libavformat/utils.c
> +++ b/libavformat/utils.c
> @@ -4819,6 +4819,13 @@ void av_url_split(char *proto, int proto_size,
>          av_strlcpy(path, ls, path_size);
>      else
>          ls = &p[strlen(p)];  // XXX
> +    /* if path does not start with a /, prepend a / */
> +    if (path[0] != '/') {
> +        char temp[1024];

What makes 1024 so special?

> +        av_strlcpy(temp, path, path_size);
> +        path[0] = '/';
> +        av_strlcpy(path + 1, temp, path_size - 1);
> +    }
>
>      /* the rest is hostname, use that to parse auth/port */
>      if (ls != p) {
> --
> 2.17.1
>
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request at ffmpeg.org with subject "unsubscribe".


More information about the ffmpeg-devel mailing list