diff --git a/libavformat/ftp.c b/libavformat/ftp.c index 761dce8128..7b0cf31492 100644 --- a/libavformat/ftp.c +++ b/libavformat/ftp.c @@ -746,6 +746,11 @@ 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"); + return AVERROR(EINVAL); + } + return 0; }