From 86a1cace276f827bd8261e624c4839b58ffc5f15 Mon Sep 17 00:00:00 2001 From: Andi Gutmans Date: Sat, 16 Dec 2000 20:52:43 +0000 Subject: [PATCH] - Make all places use MAXPATHLEN in the same way. It includes the terminating NULL. --- ext/dba/dba.c | 10 ++++++++++ ext/standard/dir.c | 2 +- main/fopen_wrappers.c | 4 ++-- main/safe_mode.c | 2 +- sapi/phttpd/phttpd.c | 2 +- sapi/servlet/servlet.c | 2 +- 6 files changed, 16 insertions(+), 6 deletions(-) diff --git a/ext/dba/dba.c b/ext/dba/dba.c index c432b70018..053861aadc 100644 --- a/ext/dba/dba.c +++ b/ext/dba/dba.c @@ -211,11 +211,21 @@ static PHP_MSHUTDOWN_FUNCTION(dba) static PHP_MINFO_FUNCTION(dba) { dba_handler *hptr; +<<<<<<< dba.c + static char handlers[80]; +======= smart_str handlers = {0}; +>>>>>>> 1.28 + + handlers[0] = '\0'; for(hptr = handler; hptr->name; hptr++) { +<<<<<<< dba.c + strlcat(handlers, hptr->name, sizeof(handlers)); +======= smart_str_appends(&handlers, hptr->name); smart_str_appendc(&handlers, ' '); +>>>>>>> 1.28 } php_info_print_table_start(); diff --git a/ext/standard/dir.c b/ext/standard/dir.c index 131540816a..97f2ac89c6 100644 --- a/ext/standard/dir.c +++ b/ext/standard/dir.c @@ -259,7 +259,7 @@ PHP_FUNCTION(getcwd) } #if HAVE_GETCWD - ret = V_GETCWD(path,MAXPATHLEN-1); + ret = V_GETCWD(path, MAXPATHLEN); #elif HAVE_GETWD ret = V_GETWD(path); /* diff --git a/main/fopen_wrappers.c b/main/fopen_wrappers.c index 9f3ce6526c..ec8a623021 100644 --- a/main/fopen_wrappers.c +++ b/main/fopen_wrappers.c @@ -360,7 +360,7 @@ PHPAPI FILE *php_fopen_primary_script(void) PHPAPI FILE *php_fopen_with_path(char *filename, char *mode, char *path, char **opened_path) { char *pathbuf, *ptr, *end; - char trypath[MAXPATHLEN + 1]; + char trypath[MAXPATHLEN]; struct stat sb; FILE *fp; int filename_length; @@ -513,7 +513,7 @@ PHPAPI char *php_strip_url_passwd(char *url) PHPAPI char *expand_filepath(const char *filepath, char *real_path) { cwd_state new_state; - char cwd[MAXPATHLEN+1]; + char cwd[MAXPATHLEN]; char *result; result = V_GETCWD(cwd, MAXPATHLEN); diff --git a/main/safe_mode.c b/main/safe_mode.c index 1a11decc69..d8ae18fa12 100644 --- a/main/safe_mode.c +++ b/main/safe_mode.c @@ -106,7 +106,7 @@ PHPAPI int php_checkuid(const char *filename, char *fopen_mode, int mode) } duid = sb.st_uid; } else { - char cwd[MAXPATHLEN+1]; + char cwd[MAXPATHLEN]; if (!V_GETCWD(cwd, MAXPATHLEN)) { php_error(E_WARNING, "Unable to access current working directory"); return 0; diff --git a/sapi/phttpd/phttpd.c b/sapi/phttpd/phttpd.c index 825fd2a3b5..a7abe61088 100644 --- a/sapi/phttpd/phttpd.c +++ b/sapi/phttpd/phttpd.c @@ -203,7 +203,7 @@ php_phttpd_request_ctor(PHLS_D SLS_DC) SG(request_info).query_string = PHG(cip)->hip->request; SG(request_info).request_method = PHG(cip)->hip->method; - SG(request_info).path_translated = malloc(MAXPATHLEN+1); + SG(request_info).path_translated = malloc(MAXPATHLEN); SG(sapi_headers).http_response_code = 200; if (url_expand(PHG(cip)->hip->url, SG(request_info).path_translated, MAXPATHLEN, &PHG(sb), NULL, NULL) == NULL) { /* handle error */ diff --git a/sapi/servlet/servlet.c b/sapi/servlet/servlet.c index 04a51798de..210e59c9b9 100644 --- a/sapi/servlet/servlet.c +++ b/sapi/servlet/servlet.c @@ -327,7 +327,7 @@ JNIEXPORT void JNICALL Java_net_php_servlet_send zend_file_handle file_handle; #ifndef VIRTUAL_DIR - char cwd[MAXPATHLEN+1]; + char cwd[MAXPATHLEN]; #endif SLS_FETCH(); PLS_FETCH(); -- 2.50.1