From d976c4f096077e97452be777d49f4e70711e7d17 Mon Sep 17 00:00:00 2001 From: Nick Kew Date: Sun, 9 Sep 2007 23:10:50 +0000 Subject: [PATCH] mod_proxy_ftp: Don't segfault on bad line in FTP listing PR 40733 [Ulf Harnhammar] git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@574100 13f79535-47bb-0310-9956-ffa450edef68 --- CHANGES | 3 +++ modules/proxy/mod_proxy_ftp.c | 8 ++++++++ 2 files changed, 11 insertions(+) diff --git a/CHANGES b/CHANGES index a926b18405..07fd67a7ef 100644 --- a/CHANGES +++ b/CHANGES @@ -2,6 +2,9 @@ Changes with Apache 2.3.0 [ When backported to 2.2.x, remove entry from this file ] + *) mod_proxy_ftp: Don't segfault on bad line in FTP listing + PR 40733 [Ulf Harnhammar ] + *) mod_proxy_ajp: Differentiate within AJP between GET and HEAD requests. PR 43060 [Jim Jagielski] diff --git a/modules/proxy/mod_proxy_ftp.c b/modules/proxy/mod_proxy_ftp.c index b5d3e6b4bc..f7e951d280 100644 --- a/modules/proxy/mod_proxy_ftp.c +++ b/modules/proxy/mod_proxy_ftp.c @@ -517,6 +517,14 @@ static apr_status_t proxy_send_dir_filter(ap_filter_t *f, } filename = strrchr(ctx->buffer, ' '); + if (filename == NULL) { + /* Line is broken. Ignore it. */ + ap_log_error(APLOG_MARK, APLOG_WARNING, 0, r->server, + "proxy_ftp: could not parse line %s", ctx->buffer); + /* erase buffer for next time around */ + ctx->buffer[0] = 0; + continue; /* while state is BODY */ + } *(filename++) = '\0'; /* handle filenames with spaces in 'em */ -- 2.40.0