[FFmpeg-devel] hls: fix baseurl missing last char

Submitted by Robert Nagy on Nov. 30, 2017, 4:31 p.m.

Details

Message ID CALdTkGEyJhW2hNSTjKzSCSbbUqXBpbE6iUq7=pbMUkinJdCPOA@mail.gmail.com
State New
Headers show

Commit Message

Robert Nagy Nov. 30, 2017, 4:31 p.m.
---
 libavformat/hlsenc.c | 9 +--------
 1 file changed, 1 insertion(+), 8 deletions(-)

SEGMENT_TYPE_FMP4)) {
--
2.15.0

Comments

Steven Liu Nov. 30, 2017, 11:23 p.m.
2017-12-01 0:31 GMT+08:00 Robert Nagy <ronag89@gmail.com>:
> ---
>  libavformat/hlsenc.c | 9 +--------
>  1 file changed, 1 insertion(+), 8 deletions(-)
>
> diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c
> index cdfbf45823..394c7130ac 100644
> --- a/libavformat/hlsenc.c
> +++ b/libavformat/hlsenc.c
> @@ -1921,14 +1921,7 @@ static int hls_write_header(AVFormatContext *s)
>      }
>
>      if (hls->baseurl) {
> -        int baseurl_len;
> -        baseurl_len = strlen(hls->baseurl);
> -        vs->baseurl = av_malloc(baseurl_len);
> -        if (!vs->baseurl) {
> -            ret = AVERROR(ENOMEM);
> -            goto fail;
> -        }
> -        av_strlcpy(vs->baseurl, hls->baseurl, baseurl_len);
> +        vs->baseurl = av_strdup(hls->baseurl);
Check the result.


Thanks
>      }
>
>      if ((hls->flags & HLS_SINGLE_FILE) && (hls->segment_type ==
> SEGMENT_TYPE_FMP4)) {
> --
> 2.15.0
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel

Patch hide | download patch | download mbox

diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c
index cdfbf45823..394c7130ac 100644
--- a/libavformat/hlsenc.c
+++ b/libavformat/hlsenc.c
@@ -1921,14 +1921,7 @@  static int hls_write_header(AVFormatContext *s)
     }

     if (hls->baseurl) {
-        int baseurl_len;
-        baseurl_len = strlen(hls->baseurl);
-        vs->baseurl = av_malloc(baseurl_len);
-        if (!vs->baseurl) {
-            ret = AVERROR(ENOMEM);
-            goto fail;
-        }
-        av_strlcpy(vs->baseurl, hls->baseurl, baseurl_len);
+        vs->baseurl = av_strdup(hls->baseurl);
     }

     if ((hls->flags & HLS_SINGLE_FILE) && (hls->segment_type ==