iliaa Tue Feb 10 14:22:19 2009 UTC
Modified files:
/php-src/main/streams plain_wrapper.c
/php-src/main fopen_wrappers.c
Log:
MFB: 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.98&r2=1.99&diff_format=u
Index: php-src/main/streams/plain_wrapper.c
diff -u php-src/main/streams/plain_wrapper.c:1.98
php-src/main/streams/plain_wrapper.c:1.99
--- php-src/main/streams/plain_wrapper.c:1.98 Wed Dec 31 11:12:39 2008
+++ php-src/main/streams/plain_wrapper.c Tue Feb 10 14:22:19 2009
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: plain_wrapper.c,v 1.98 2008/12/31 11:12:39 sebastian Exp $ */
+/* $Id: plain_wrapper.c,v 1.99 2009/02/10 14:22:19 iliaa Exp $ */
#include "php.h"
#include "php_globals.h"
@@ -1289,7 +1289,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);
@@ -1341,7 +1343,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 %d", 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.210&r2=1.211&diff_format=u
Index: php-src/main/fopen_wrappers.c
diff -u php-src/main/fopen_wrappers.c:1.210 php-src/main/fopen_wrappers.c:1.211
--- php-src/main/fopen_wrappers.c:1.210 Wed Dec 31 11:12:38 2008
+++ php-src/main/fopen_wrappers.c Tue Feb 10 14:22:19 2009
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: fopen_wrappers.c,v 1.210 2008/12/31 11:12:38 sebastian Exp $ */
+/* $Id: fopen_wrappers.c,v 1.211 2009/02/10 14:22:19 iliaa Exp $ */
/* {{{ includes
*/
@@ -636,7 +636,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);
+ }
fp = php_fopen_and_set_opened_path(trypath, mode, opened_path
TSRMLS_CC);
if (fp) {
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php