diff mbox

[FFmpeg-devel] avformat/hlsenc: fix cid 1401346 Dereferencing pointer error

Message ID 20170220090330.8558-1-lq@chinaffmpeg.org
State New
Headers show

Commit Message

Liu Steven Feb. 20, 2017, 9:03 a.m. UTC
check if proto is null before av_strcasecmp
CID:  1401346

Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
---
 libavformat/hlsenc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Steven Liu Feb. 21, 2017, 3:39 p.m. UTC | #1
2017-02-20 17:03 GMT+08:00 Steven Liu <lq@chinaffmpeg.org>:

> check if proto is null before av_strcasecmp
> CID:  1401346
>
> Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
> ---
>  libavformat/hlsenc.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c
> index e673f59..fad6cae 100644
> --- a/libavformat/hlsenc.c
> +++ b/libavformat/hlsenc.c
> @@ -668,7 +668,7 @@ static void hls_free_segments(HLSSegment *p)
>  static void set_http_options(AVFormatContext *s, AVDictionary **options,
> HLSContext *c)
>  {
>      const char *proto = avio_find_protocol_name(s->filename);
> -    int http_base_proto = !av_strcasecmp(proto, "http") ||
> !av_strcasecmp(proto, "https");
> +    int http_base_proto = proto ? (!av_strcasecmp(proto, "http") ||
> !av_strcasecmp(proto, "https")) : 0;
>
>      if (c->method) {
>          av_dict_set(options, "method", c->method, 0);
> --
> 2.10.1.382.ga23ca1b.dirty
>
>
>
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>


Pushed

Thanks!
diff mbox

Patch

diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c
index e673f59..fad6cae 100644
--- a/libavformat/hlsenc.c
+++ b/libavformat/hlsenc.c
@@ -668,7 +668,7 @@  static void hls_free_segments(HLSSegment *p)
 static void set_http_options(AVFormatContext *s, AVDictionary **options, HLSContext *c)
 {
     const char *proto = avio_find_protocol_name(s->filename);
-    int http_base_proto = !av_strcasecmp(proto, "http") || !av_strcasecmp(proto, "https");
+    int http_base_proto = proto ? (!av_strcasecmp(proto, "http") || !av_strcasecmp(proto, "https")) : 0;
 
     if (c->method) {
         av_dict_set(options, "method", c->method, 0);