]> granicus.if.org Git - apache/commitdiff
mod_proxy_ftp: Don't segfault on bad line in FTP listing
authorNick Kew <niq@apache.org>
Sun, 9 Sep 2007 23:10:50 +0000 (23:10 +0000)
committerNick Kew <niq@apache.org>
Sun, 9 Sep 2007 23:10:50 +0000 (23:10 +0000)
PR 40733 [Ulf Harnhammar]

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@574100 13f79535-47bb-0310-9956-ffa450edef68

CHANGES
modules/proxy/mod_proxy_ftp.c

diff --git a/CHANGES b/CHANGES
index a926b184055b801bfd503f3514c9c98053788469..07fd67a7ef67d4d101a5c62742b1fa59bf5d05fc 100644 (file)
--- 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 <metaur telia.com>]
+
   *) mod_proxy_ajp: Differentiate within AJP between GET and HEAD
      requests. PR 43060 [Jim Jagielski]
 
index b5d3e6b4bcea1828e2611be14a793ff2a18f13c1..f7e951d280e0b3f853cb1759c334d3f6ab62e9ec 100644 (file)
@@ -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 */