avformat/webm_chunk: Check header filename length

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
Michael Niedermayer 2019-05-02 20:45:14 +02:00
parent 4fd74a2b10
commit 3b5b977c9f
1 changed files with 6 additions and 1 deletions

View File

@ -92,11 +92,16 @@ static int get_chunk_filename(AVFormatContext *s, int is_header, char *filename)
return AVERROR(EINVAL); return AVERROR(EINVAL);
} }
if (is_header) { if (is_header) {
int len;
if (!wc->header_filename) { if (!wc->header_filename) {
av_log(oc, AV_LOG_ERROR, "No header filename provided\n"); av_log(oc, AV_LOG_ERROR, "No header filename provided\n");
return AVERROR(EINVAL); return AVERROR(EINVAL);
} }
av_strlcpy(filename, wc->header_filename, MAX_FILENAME_SIZE); len = av_strlcpy(filename, wc->header_filename, MAX_FILENAME_SIZE);
if (len >= MAX_FILENAME_SIZE) {
av_log(oc, AV_LOG_ERROR, "Header filename too long\n");
return AVERROR(EINVAL);
}
} else { } else {
if (av_get_frame_filename(filename, MAX_FILENAME_SIZE, if (av_get_frame_filename(filename, MAX_FILENAME_SIZE,
s->url, wc->chunk_index - 1) < 0) { s->url, wc->chunk_index - 1) < 0) {