Commit b6093e8c authored by Luca Barbato's avatar Luca Barbato

hlsenc: Correctly write down all 16 bytes in hex

Signed-off-by: 's avatarLuca Barbato <lu_zero@gentoo.org>
parent bc258976
...@@ -102,11 +102,12 @@ static void free_encryption(AVFormatContext *s) ...@@ -102,11 +102,12 @@ static void free_encryption(AVFormatContext *s)
av_freep(&hls->key_basename); 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]; char hex[33];
ff_data_to_hex(hex, buf, sizeof(buf), 0); ff_data_to_hex(hex, buf, len, 0);
hex[32] = '\0'; hex[32] = '\0';
return av_dict_set(dict, key, hex, 0); return av_dict_set(dict, key, hex, 0);
...@@ -136,7 +137,7 @@ static int setup_encryption(AVFormatContext *s) ...@@ -136,7 +137,7 @@ static int setup_encryption(AVFormatContext *s)
return AVERROR(EINVAL); 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; return ret;
k = hls->key; k = hls->key;
} else { } else {
...@@ -145,7 +146,7 @@ static int setup_encryption(AVFormatContext *s) ...@@ -145,7 +146,7 @@ static int setup_encryption(AVFormatContext *s)
return ret; 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; return ret;
k = buf; k = buf;
} }
...@@ -158,7 +159,7 @@ static int setup_encryption(AVFormatContext *s) ...@@ -158,7 +159,7 @@ static int setup_encryption(AVFormatContext *s)
return AVERROR(EINVAL); 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; return ret;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment