]> git.sesse.net Git - ffmpeg/commitdiff
avformat/hlsenc: fix cid 1401346 Dereferencing pointer error
authorSteven Liu <lq@chinaffmpeg.org>
Tue, 21 Feb 2017 15:38:39 +0000 (23:38 +0800)
committerSteven Liu <lq@chinaffmpeg.org>
Tue, 21 Feb 2017 15:38:39 +0000 (23:38 +0800)
check if proto is null before av_strcasecmp
CID:  1401346

Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
libavformat/hlsenc.c

index e673f59710de2474437041f6692ae0cbb1b7b4f3..86a3b05f0fc1876b3a204c8352d3b5552486f741 100644 (file)
@@ -668,11 +668,11 @@ 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);
-    } else if (proto && http_base_proto) {
+    } else if (http_base_proto) {
         av_log(c, AV_LOG_WARNING, "No HTTP method set, hls muxer defaulting to method PUT.\n");
         av_dict_set(options, "method", "PUT", 0);
     }