iliaa Tue Feb 10 14:18:29 2009 UTC
Modified files: (Branch: PHP_5_2)
/php-src/main/streams plain_wrapper.c
/php-src/main fopen_wrappers.c
Log:
Added path truncation E_NOTICE to let people now when path resolving caused
the file path to be truncated.
http://cvs.php.net/viewvc.cgi/php-src/main/streams/plain_wrapper.c?r1=1.52.2.6.2.29&r2=1.52.2.6.2.30&diff_format=u
Index: php-src/main/streams/plain_wrapper.c
diff -u php-src/main/streams/plain_wrapper.c:1.52.2.6.2.29
php-src/main/streams/plain_wrapper.c:1.52.2.6.2.30
--- php-src/main/streams/plain_wrapper.c:1.52.2.6.2.29 Wed Dec 31 11:17:48 2008
+++ php-src/main/streams/plain_wrapper.c Tue Feb 10 14:18:29 2009
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: plain_wrapper.c,v 1.52.2.6.2.29 2008/12/31 11:17:48 sebastian Exp $ */
+/* $Id: plain_wrapper.c,v 1.52.2.6.2.30 2009/02/10 14:18:29 iliaa Exp $ */
#include "php.h"
#include "php_globals.h"
@@ -1324,7 +1324,9 @@
/* getcwd() will return always return [DRIVE_LETTER]:/) on
windows. */
*(cwd+3) = '\0';
- snprintf(trypath, MAXPATHLEN, "%s%s", cwd, filename);
+ if (snprintf(trypath, MAXPATHLEN, "%s%s", cwd, filename) >
MAXPATHLEN) {
+ php_error_docref(NULL TSRMLS_CC, E_NOTICE, "%s/%s path
was truncated to %d", cwd, filename, MAXPATHLEN);
+ }
free(cwd);
@@ -1385,7 +1387,9 @@
if (*ptr == '\0') {
goto stream_skip;
}
- snprintf(trypath, MAXPATHLEN, "%s/%s", ptr, filename);
+ if (snprintf(trypath, MAXPATHLEN, "%s/%s", ptr, filename) >
MAXPATHLEN) {
+ php_error_docref(NULL TSRMLS_CC, E_NOTICE, "%s/%s path
was truncated to %file", ptr, filename, MAXPATHLEN);
+ }
if (((options & STREAM_DISABLE_OPEN_BASEDIR) == 0) &&
php_check_open_basedir_ex(trypath, 0 TSRMLS_CC)) {
goto stream_skip;
http://cvs.php.net/viewvc.cgi/php-src/main/fopen_wrappers.c?r1=1.175.2.3.2.21&r2=1.175.2.3.2.22&diff_format=u
Index: php-src/main/fopen_wrappers.c
diff -u php-src/main/fopen_wrappers.c:1.175.2.3.2.21
php-src/main/fopen_wrappers.c:1.175.2.3.2.22
--- php-src/main/fopen_wrappers.c:1.175.2.3.2.21 Wed Dec 31 11:17:47 2008
+++ php-src/main/fopen_wrappers.c Tue Feb 10 14:18:29 2009
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: fopen_wrappers.c,v 1.175.2.3.2.21 2008/12/31 11:17:47 sebastian Exp $
*/
+/* $Id: fopen_wrappers.c,v 1.175.2.3.2.22 2009/02/10 14:18:29 iliaa Exp $ */
/* {{{ includes
*/
@@ -528,7 +528,9 @@
*end = '\0';
end++;
}
- snprintf(trypath, MAXPATHLEN, "%s/%s", ptr, filename);
+ if (snprintf(trypath, MAXPATHLEN, "%s/%s", ptr, filename) >
MAXPATHLEN) {
+ php_error_docref(NULL TSRMLS_CC, E_NOTICE, "%s/%s path
was truncated to %d", ptr, filename, MAXPATHLEN);
+ }
if (PG(safe_mode)) {
if (VCWD_STAT(trypath, &sb) == 0) {
/* file exists ... check permission */
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php