iliaa           Tue Feb 10 14:18:46 2009 UTC

  Modified files:              (Branch: PHP_5_3)
    /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.52.2.6.2.23.2.10&r2=1.52.2.6.2.23.2.11&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.23.2.10 
php-src/main/streams/plain_wrapper.c:1.52.2.6.2.23.2.11
--- php-src/main/streams/plain_wrapper.c:1.52.2.6.2.23.2.10     Wed Dec 31 
11:15:48 2008
+++ php-src/main/streams/plain_wrapper.c        Tue Feb 10 14:18:46 2009
@@ -16,7 +16,7 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: plain_wrapper.c,v 1.52.2.6.2.23.2.10 2008/12/31 11:15:48 sebastian Exp 
$ */
+/* $Id: plain_wrapper.c,v 1.52.2.6.2.23.2.11 2009/02/10 14:18:46 iliaa Exp $ */
 
 #include "php.h"
 #include "php_globals.h"
@@ -1328,7 +1328,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);
                
@@ -1389,7 +1391,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.13.2.15&r2=1.175.2.3.2.13.2.16&diff_format=u
Index: php-src/main/fopen_wrappers.c
diff -u php-src/main/fopen_wrappers.c:1.175.2.3.2.13.2.15 
php-src/main/fopen_wrappers.c:1.175.2.3.2.13.2.16
--- php-src/main/fopen_wrappers.c:1.175.2.3.2.13.2.15   Wed Dec 31 11:15:47 2008
+++ php-src/main/fopen_wrappers.c       Tue Feb 10 14:18:46 2009
@@ -17,7 +17,7 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: fopen_wrappers.c,v 1.175.2.3.2.13.2.15 2008/12/31 11:15:47 sebastian 
Exp $ */
+/* $Id: fopen_wrappers.c,v 1.175.2.3.2.13.2.16 2009/02/10 14:18:46 iliaa Exp $ 
*/
 
 /* {{{ includes
  */
@@ -706,7 +706,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

Reply via email to