On 10.02.2009 17:18, Ilia Alshanetsky wrote: > 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); > + }
I believe it should be >= MAXPATHLEN, since "a return value of size or more means that the output was truncated." (c) man snprintf And size is truncated to MAXPATHLEN-1, btw. -- Wbr, Antony Dovgal -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php