From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.ffmpeg.org (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTPS id BD7754C698 for ; Mon, 4 Aug 2025 16:00:17 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.ffmpeg.org (Postfix) with ESMTP id 07B5468CBCA; Mon, 4 Aug 2025 19:00:15 +0300 (EEST) Received: from iq.passwd.hu (iq.passwd.hu [217.27.212.140]) by ffbox0-bg.ffmpeg.org (Postfix) with ESMTP id 3FAB868A408 for ; Mon, 4 Aug 2025 19:00:12 +0300 (EEST) Received: from localhost (localhost [127.0.0.1]) by iq.passwd.hu (Postfix) with ESMTP id BB342EB671 for ; Mon, 4 Aug 2025 17:57:57 +0200 (CEST) X-Virus-Scanned: amavisd-new at passwd.hu Received: from iq.passwd.hu ([127.0.0.1]) by localhost (iq.passwd.hu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id facefjeDhHZD for ; Mon, 4 Aug 2025 17:57:55 +0200 (CEST) Received: from iq (iq [217.27.212.140]) by iq.passwd.hu (Postfix) with ESMTPS id 40E65EB5F2 for ; Mon, 4 Aug 2025 17:57:55 +0200 (CEST) Date: Mon, 4 Aug 2025 17:57:55 +0200 (CEST) From: Marton Balint To: FFmpeg development discussions and patches In-Reply-To: <20250803225700.GK29660@pb2> Message-ID: References: <20250731021339.2955179-1-caifan0425@163.com> <20250731082135.3114297-1-caifan0425@163.com> <20250803225700.GK29660@pb2> MIME-Version: 1.0 Subject: Re: [FFmpeg-devel] =?utf-8?q?=5BPATCH_v2_1/1=5D_libavformat/img2enc?= =?utf-8?b?LmM6IHJtIHdhcm5pbmcg4oCYLnRtcOKAmSBkaXJlY3RpdmUgb3V0cHV0IG1h?= =?utf-8?q?y_be_truncated?= X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: On Mon, 4 Aug 2025, Michael Niedermayer wrote: > On Thu, Jul 31, 2025 at 04:21:35PM +0800, Cai Fan wrote: >> Signed-off-by: Cai Fan >> --- >> libavformat/img2enc.c | 7 ++++++- >> 1 file changed, 6 insertions(+), 1 deletion(-) >> >> diff --git a/libavformat/img2enc.c b/libavformat/img2enc.c >> index 41638d92b8..9a5718a8da 100644 >> --- a/libavformat/img2enc.c >> +++ b/libavformat/img2enc.c >> @@ -180,7 +180,12 @@ static int write_packet(AVFormatContext *s, AVPacket *pkt) >> } >> for (i = 0; i < 4; i++) { >> av_dict_copy(&options, img->protocol_opts, 0); >> - snprintf(img->tmp[i], sizeof(img->tmp[i]), "%s.tmp", filename); >> + int len = snprintf(img->tmp[i], sizeof(img->tmp[i]), "%s.tmp", filename); >> + if (len < 0 || len >= sizeof(img->tmp[i])) { >> + av_log(s, AV_LOG_ERROR, "filename '%s' exceeds buffer size %zu\n", filename, sizeof(img->tmp[i])); >> + ret = AVERROR(EINVAL); >> + goto fail; >> + } > > is there a reason this doesnt use av_asprintf() ? > that is allocate as needed Actually I did that extra step and more: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/20077 So I guess this patch is now obsolete, sorry about that, but it was a relatively low hanging fruit. Regards, Marton _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".