[FFmpeg-devel] [PATCH 1/1] libavformat/img2enc.c: rm warning ‘.tmp’ directive output may be truncated
Steven Liu
lingjiujianke at gmail.com
Wed Jul 30 08:36:44 EEST 2025
Cai Fan <caifan0425 at 163.com>于2025年7月30日 周三11:43写道:
> Signed-off-by: Cai Fan <caifan0425 at 163.com>
> ---
> libavformat/img2enc.c | 5 +++++
> 1 file changed, 5 insertions(+)
>
> diff --git a/libavformat/img2enc.c b/libavformat/img2enc.c
> index 41638d92b8..f7d983ec54 100644
> --- a/libavformat/img2enc.c
> +++ b/libavformat/img2enc.c
> @@ -180,6 +180,11 @@ static int write_packet(AVFormatContext *s, AVPacket
> *pkt)
> }
> for (i = 0; i < 4; i++) {
> av_dict_copy(&options, img->protocol_opts, 0);
> + if (strlen(filename) + 5 >= sizeof(img->tmp[i])) {
> + av_log(s, AV_LOG_ERROR, "Filename too long: %s\n", filename);
> + ret = AVERROR(EINVAL);
> + goto fail;
> + }
> snprintf(img->tmp[i], sizeof(img->tmp[i]), "%s.tmp", filename);
> av_strlcpy(img->target[i], filename, sizeof(img->target[i]));
> if (s->io_open(s, &pb[i], img->use_rename ? img->tmp[i] :
> filename, AVIO_FLAG_WRITE, &options) < 0) {
> --
> 2.34.1
>
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request at ffmpeg.org with subject "unsubscribe".
LGTM
Thanks
Steven
>
>
More information about the ffmpeg-devel
mailing list