From 6c5dad52b2b6d97ab090da0bef63d6ab31b4eaf4 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Thu, 28 May 2026 21:37:38 +0200 Subject: [PATCH] avformat/ftp: Check string used for RNTO Found-by: Forgejo Fairy Signed-off-by: Michael Niedermayer (cherry picked from commit 4d24cb1c39c049cb49b89578e55f233700267921) Signed-off-by: Michael Niedermayer --- libavformat/ftp.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/libavformat/ftp.c b/libavformat/ftp.c index 6e6c8b9940..3865177f99 100644 --- a/libavformat/ftp.c +++ b/libavformat/ftp.c @@ -1171,6 +1171,10 @@ static int ftp_move(URLContext *h_src, URLContext *h_dst) av_url_split(0, 0, 0, 0, 0, 0, 0, path, sizeof(path), h_dst->filename); + if (is_bad_string(path)) { + ret = AVERROR(EINVAL); + goto cleanup; + } ret = snprintf(command, sizeof(command), "RNTO %s\r\n", path); if (ret >= sizeof(command)) { ret = AVERROR(ENOSYS);