]> granicus.if.org Git - apache/commitdiff
Fixed a problem with FTP directories and charcters being chopped here
authorGraham Leggett <minfrin@apache.org>
Fri, 13 Apr 2001 02:07:05 +0000 (02:07 +0000)
committerGraham Leggett <minfrin@apache.org>
Fri, 13 Apr 2001 02:07:05 +0000 (02:07 +0000)
and there.
PR:
Obtained from:
Reviewed by:

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

modules/proxy/proxy_ftp.c

index 5c089a19076a3047b61cda29863d8f2fc6e31e9d..a3c6a825f219f5c021e72813779efc53cf0bbbf8 100644 (file)
@@ -340,6 +340,7 @@ apr_status_t ap_proxy_send_dir_filter(ap_filter_t *f, apr_bucket_brigade *in)
        ctx->buffer[0] = 0;
 
        /* get a complete line */
+       /* if the buffer overruns - throw data away */
        while (!found && !APR_BRIGADE_EMPTY(ctx->in)) {
            char *pos, *response;
            apr_size_t len, max;
@@ -354,7 +355,9 @@ apr_status_t ap_proxy_send_dir_filter(ap_filter_t *f, apr_bucket_brigade *in)
            pos = memchr(response, APR_ASCII_LF, len);
            if (pos != NULL) {
                if ((pos - response + 1) != len) {
+                   len = pos - response + 1;
                    apr_bucket_split(e, pos - response + 1);
+                   
                }
                found = 1;
            }
@@ -362,7 +365,9 @@ apr_status_t ap_proxy_send_dir_filter(ap_filter_t *f, apr_bucket_brigade *in)
            if (len > max) {
                len = max;
            }
-           apr_cpystrn(ctx->buffer+strlen(ctx->buffer), response, len);
+/* strncat works here, but apr_cpystrn does not - the last char gets chopped, dunno why */
+/*         apr_cpystrn(ctx->buffer+strlen(ctx->buffer), response, len);*/
+           strncat(ctx->buffer, response, len);
            APR_BUCKET_REMOVE(e);
            apr_bucket_destroy(e);
        }
@@ -378,10 +383,6 @@ apr_status_t ap_proxy_send_dir_filter(ap_filter_t *f, apr_bucket_brigade *in)
            return APR_SUCCESS;
        }
 
-ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r,
-                      "proxy: directory line: [%s]", ctx->buffer);
-
-
        /* a symlink? */
        if (ctx->buffer[0] == 'l' && (filename=strstr(ctx->buffer, " -> ")) != NULL) {
            char *link_ptr = filename;