This is an automated email from the git hooks/post-receive script. Git pushed a commit to branch release/6.1 in repository ffmpeg.
commit ad6033048e9fd74a7747082240c53324a6a76583 Author: Michael Niedermayer <[email protected]> AuthorDate: Tue May 19 22:05:29 2026 +0200 Commit: Michael Niedermayer <[email protected]> CommitDate: Sun Jun 14 19:38:55 2026 +0200 avformat/ftp: Check for Telnet IAC characters and other non printable ASCII chars Signed-off-by: Michael Niedermayer <[email protected]> (cherry picked from commit 090838497ccecb017e8ffd304dcef4b3ca929fa6) Signed-off-by: Michael Niedermayer <[email protected]> --- libavformat/ftp.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/libavformat/ftp.c b/libavformat/ftp.c index 6a765e660c..951d575aeb 100644 --- a/libavformat/ftp.c +++ b/libavformat/ftp.c @@ -99,6 +99,16 @@ static const AVClass ftp_context_class = { static int ftp_close(URLContext *h); +static int is_bad_string(const unsigned char *s) +{ + while(*s) { + if (*s < 0x20 || *s == 0x7F || *s == 0xFF) + return 1; + s++; + } + return 0; +} + static int ftp_getc(FTPContext *s) { int len; @@ -249,7 +259,7 @@ static int ftp_auth(FTPContext *s) static const int user_codes[] = {331, 230, 0}; static const int pass_codes[] = {230, 0}; - if (strpbrk(s->user, "\r\n")) + if (is_bad_string(s->user)) return AVERROR(EINVAL); err = snprintf(buf, sizeof(buf), "USER %s\r\n", s->user); if (err >= sizeof(buf)) @@ -258,7 +268,7 @@ static int ftp_auth(FTPContext *s) err = ftp_send_command(s, buf, user_codes, NULL); if (err == 331) { if (s->password) { - if (strpbrk(s->password, "\r\n")) + if (is_bad_string(s->password)) return AVERROR(EINVAL); err = snprintf(buf, sizeof(buf), "PASS %s\r\n", s->password); if (err >= sizeof(buf)) @@ -745,8 +755,8 @@ static int ftp_connect(URLContext *h, const char *url) av_free(s->path); s->path = newpath; - if (strpbrk(s->path, "\r\n")) { - av_log(h, AV_LOG_ERROR, "Path contains CR/LF characters\n"); + if (is_bad_string(s->path)) { + av_log(h, AV_LOG_ERROR, "Path contains non-printable characters\n"); return AVERROR(EINVAL); } _______________________________________________ ffmpeg-cvslog mailing list -- [email protected] To unsubscribe send an email to [email protected]
