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); php_wddx_add_chunk(packet, tmp_buf); @@ -624,8 +624,8 @@ if (name) { name_esc = php_escape_html_entities(name, name_len, &name_esc_len, 0, ENT_QUOTES, NULL TSRMLS_CC); - tmp_buf = emalloc(name_esc_len + 1); - snprintf(tmp_buf, name_esc_len, WDDX_VAR_S, name_esc); + tmp_buf = emalloc(name_esc_len + WDDX_VAR_S_LEN + 1); + snprintf(tmp_buf, name_esc_len + WDDX_VAR_S_LEN + 1, WDDX_VAR_S, name_esc); php_wddx_add_chunk(packet, tmp_buf); efree(tmp_buf); efree(name_esc);
-- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php