From ec5abc7ad6af052aaff5d9094ab468f4acdcf229 Mon Sep 17 00:00:00 2001 From: Stefan Fritsch Date: Fri, 14 Sep 2012 21:06:05 +0000 Subject: [PATCH] ap_sub_req_lookup_dirent() depends on the over-allocation done by ap_make_full_path and ap_escape_uri, so let's document it so that it is not accidentally removed. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1384924 13f79535-47bb-0310-9956-ffa450edef68 --- include/httpd.h | 7 +++++-- server/request.c | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/include/httpd.h b/include/httpd.h index da181d4d4a..9f3fea9bb6 100644 --- a/include/httpd.h +++ b/include/httpd.h @@ -1579,7 +1579,9 @@ AP_DECLARE(char *) ap_escape_path_segment_buffer(char *c, const char *s); * @param p The pool to allocate from * @param path The path to convert * @param partial if set, assume that the path will be appended to something - * with a '/' in it (and thus does not prefix "./") + * with a '/' in it (and thus does not prefix "./"). + * If not set, there will be one byte of additional space after the + * NUL, to allow the caller to append a '/'. * @return The converted URL */ AP_DECLARE(char *) ap_os_escape_path(apr_pool_t *p, const char *path, int partial); @@ -1692,7 +1694,8 @@ AP_DECLARE(char *) ap_make_dirstr_parent(apr_pool_t *p, const char *s); * @param a The pool to allocate from * @param dir The directory name * @param f The filename - * @return A copy of the full path + * @return A copy of the full path, with one byte of extra space after the NUL + * to allow the caller to add a trailing '/'. * @note Never consider using this function if you are dealing with filesystem * names that need to remain canonical, unless you are merging an apr_dir_read * path and returned filename. Otherwise, the result is not canonical. diff --git a/server/request.c b/server/request.c index 4abe99ca76..a6fb1cb11b 100644 --- a/server/request.c +++ b/server/request.c @@ -2160,7 +2160,7 @@ AP_DECLARE(request_rec *) ap_sub_req_lookup_dirent(const apr_finfo_t *dirent, } if (rnew->finfo.filetype == APR_DIR) { - /* ap_make_full_path overallocated the buffers + /* ap_make_full_path and ap_escape_uri overallocated the buffers * by one character to help us out here. */ strcat(rnew->filename, "/"); -- 2.40.0