[FFmpeg-cvslog] hlsenc: Correctly write down all 16 bytes in hex

Luca Barbato git at videolan.org
Thu Sep 28 02:34:32 EEST 2017


ffmpeg | branch: master | Luca Barbato <lu_zero at gentoo.org> | Thu Feb  9 23:27:41 2017 +0100| [b6093e8c72a80710f086c678ab0730cf30953b5c] | committer: Luca Barbato

hlsenc: Correctly write down all 16 bytes in hex

Signed-off-by: Luca Barbato <lu_zero at gentoo.org>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=b6093e8c72a80710f086c678ab0730cf30953b5c
---

 libavformat/hlsenc.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c
index 05c9adb959..7aef02b805 100644
--- a/libavformat/hlsenc.c
+++ b/libavformat/hlsenc.c
@@ -102,11 +102,12 @@ static void free_encryption(AVFormatContext *s)
     av_freep(&hls->key_basename);
 }
 
-static int dict_set_bin(AVDictionary **dict, const char *key, uint8_t *buf)
+static int dict_set_bin(AVDictionary **dict, const char *key,
+                        uint8_t *buf, size_t len)
 {
     char hex[33];
 
-    ff_data_to_hex(hex, buf, sizeof(buf), 0);
+    ff_data_to_hex(hex, buf, len, 0);
     hex[32] = '\0';
 
     return av_dict_set(dict, key, hex, 0);
@@ -136,7 +137,7 @@ static int setup_encryption(AVFormatContext *s)
             return AVERROR(EINVAL);
         }
 
-        if ((ret = dict_set_bin(&hls->enc_opts, "key", hls->key)) < 0)
+        if ((ret = dict_set_bin(&hls->enc_opts, "key", hls->key, hls->key_len)) < 0)
             return ret;
         k = hls->key;
     } else {
@@ -145,7 +146,7 @@ static int setup_encryption(AVFormatContext *s)
             return ret;
         }
 
-        if ((ret = dict_set_bin(&hls->enc_opts, "key", buf)) < 0)
+        if ((ret = dict_set_bin(&hls->enc_opts, "key", buf, sizeof(buf))) < 0)
             return ret;
         k = buf;
     }
@@ -158,7 +159,7 @@ static int setup_encryption(AVFormatContext *s)
             return AVERROR(EINVAL);
         }
 
-        if ((ret = dict_set_bin(&hls->enc_opts, "iv", hls->iv)) < 0)
+        if ((ret = dict_set_bin(&hls->enc_opts, "iv", hls->iv, hls->iv_len)) < 0)
             return ret;
     }
 



More information about the ffmpeg-cvslog mailing list