1
0
mirror of https://github.com/apache/httpd.git synced 2026-01-06 09:01:14 +03:00

Follow up to r1384924 .

Update comment and allocate one extra byte to be safe, even if not needed in the particular case described in r1384924.

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1589599 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Christophe Jaillet
2014-04-24 06:29:28 +00:00
parent e61786314c
commit 075cd89e14
2 changed files with 7 additions and 4 deletions

View File

@@ -1669,9 +1669,8 @@ AP_DECLARE(char *) ap_escape_path_segment_buffer(char *c, const char *s)
* @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 "./").
* 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
* @return The converted URL, with one byte of extra space after the NUL
* to allow the caller to add a trailing '/'.
* @deprecated Replaced by apr_pescape_path() in APR
*/
AP_DECLARE(char *) ap_os_escape_path(apr_pool_t *p, const char *path, int partial)

View File

@@ -1801,7 +1801,11 @@ AP_DECLARE(char *) ap_escape_path_segment(apr_pool_t *p, const char *segment)
AP_DECLARE(char *) ap_os_escape_path(apr_pool_t *p, const char *path, int partial)
{
char *copy = apr_palloc(p, 3 * strlen(path) + 3);
/* Allocate +3 for potential "./" and trailing NULL.
* Allocate another +1 to allow the caller to add a trailing '/' (see
* comment in 'ap_sub_req_lookup_dirent')
*/
char *copy = apr_palloc(p, 3 * strlen(path) + 3 + 1);
const unsigned char *s = (const unsigned char *)path;
unsigned char *d = (unsigned char *)copy;
unsigned c;