Commit d7cb5a8d authored by Michael Niedermayer's avatar Michael Niedermayer

ffmpeg_filter: fix unsafe snprintf() usage

Signed-off-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parent 1fc3e8f4
...@@ -424,18 +424,17 @@ static int configure_output_audio_filter(FilterGraph *fg, OutputFilter *ofilter, ...@@ -424,18 +424,17 @@ static int configure_output_audio_filter(FilterGraph *fg, OutputFilter *ofilter,
if (sample_fmts || sample_rates || channel_layouts) { if (sample_fmts || sample_rates || channel_layouts) {
AVFilterContext *format; AVFilterContext *format;
char args[256]; char args[256];
int len = 0; args[0] = 0;
if (sample_fmts) if (sample_fmts)
len += snprintf(args + len, sizeof(args) - len, "sample_fmts=%s:", av_strlcatf(args, sizeof(args), "sample_fmts=%s:",
sample_fmts); sample_fmts);
if (sample_rates) if (sample_rates)
len += snprintf(args + len, sizeof(args) - len, "sample_rates=%s:", av_strlcatf(args, sizeof(args), "sample_rates=%s:",
sample_rates); sample_rates);
if (channel_layouts) if (channel_layouts)
len += snprintf(args + len, sizeof(args) - len, "channel_layouts=%s:", av_strlcatf(args, sizeof(args), "channel_layouts=%s:",
channel_layouts); channel_layouts);
args[len - 1] = 0;
av_freep(&sample_fmts); av_freep(&sample_fmts);
av_freep(&sample_rates); av_freep(&sample_rates);
......
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