In-Reply-To: <[EMAIL PROTECTED]> Message-ID: <[EMAIL PROTECTED]> References: <[EMAIL PROTECTED]> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed
On Wed, 5 Oct 2005, Rob Richards wrote: > > rrichards Wed Oct 5 18:36:11 2005 EDT > > Modified files: (Branch: PHP_5_1) > /php-src/ext/wddx php_wddx_api.h wddx.c > Log: > MFH: fix buffer lengths passed to snprintf > > http://cvs.php.net/diff.php/php-src/ext/wddx/php_wddx_api.h?r1=1.23&r2=1.23.2.1&ty=u > Index: php-src/ext/wddx/php_wddx_api.h > diff -u php-src/ext/wddx/php_wddx_api.h:1.23 > php-src/ext/wddx/php_wddx_api.h:1.23.2.1 > --- php-src/ext/wddx/php_wddx_api.h:1.23 Wed Aug 3 10:08:20 2005 > +++ php-src/ext/wddx/php_wddx_api.h Wed Oct 5 18:36:10 2005 > @@ -16,7 +16,7 @@ > +----------------------------------------------------------------------+ > */ > > -/* $Id: php_wddx_api.h,v 1.23 2005/08/03 14:08:20 sniper Exp $ */ > +/* $Id: php_wddx_api.h,v 1.23.2.1 2005/10/05 22:36:10 rrichards Exp $ */ > > #ifndef PHP_WDDX_API_H > #define PHP_WDDX_API_H > @@ -47,6 +47,9 @@ > #define WDDX_VAR_S "<var name='%s'>" > #define WDDX_VAR_E "</var>" > > +#define WDDX_NUMBER_LEN 17 > +#define WDDX_VAR_S_LEN 13 > + > #define php_wddx_add_chunk(packet, str) smart_str_appends(packet, str) > #define php_wddx_add_chunk_ex(packet, str, len) > smart_str_appendl(packet, str, len) > #define php_wddx_add_chunk_static(packet, str) smart_str_appendl(packet, str, > sizeof(str)-1) > http://cvs.php.net/diff.php/php-src/ext/wddx/wddx.c?r1=1.119.2.3&r2=1.119.2.4&ty=u > Index: php-src/ext/wddx/wddx.c > diff -u php-src/ext/wddx/wddx.c:1.119.2.3 php-src/ext/wddx/wddx.c:1.119.2.4 > --- php-src/ext/wddx/wddx.c:1.119.2.3 Fri Sep 16 13:11:02 2005 > +++ php-src/ext/wddx/wddx.c Wed Oct 5 18:36:10 2005 > @@ -16,7 +16,7 @@ > +----------------------------------------------------------------------+ > */ > > -/* $Id: wddx.c,v 1.119.2.3 2005/09/16 17:11:02 tony2001 Exp $ */ > +/* $Id: wddx.c,v 1.119.2.4 2005/10/05 22:36:10 rrichards Exp $ */ > > #include "php.h" > > @@ -422,7 +422,7 @@ > tmp = *var; > zval_copy_ctor(&tmp); > convert_to_string(&tmp); > - snprintf(tmp_buf, Z_STRLEN(tmp), WDDX_NUMBER, Z_STRVAL(tmp)); > + snprintf(tmp_buf, Z_STRLEN(tmp) + WDDX_NUMBER_LEN + 1, WDDX_NUMBER, > Z_STRVAL(tmp)); > zval_dtor(&tmp); Why not like this: snprintf(tmp_buf, Z_STRLEN(tmp) + sizeof(WDDX_NUMBER) + 1, WDDX_NUMBER, Z_STRVAL(tmp)); Adding extra define just for this seems a bit overkill. (and it is error prone too :) --Jani -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php