rrichards               Wed Oct  5 18:35:17 2005 EDT

  Modified files:              
    /php-src/ext/wddx   php_wddx_api.h wddx.c 
  Log:
  fix buffer lengths passed to snprintf
  
http://cvs.php.net/diff.php/php-src/ext/wddx/php_wddx_api.h?r1=1.24&r2=1.25&ty=u
Index: php-src/ext/wddx/php_wddx_api.h
diff -u php-src/ext/wddx/php_wddx_api.h:1.24 
php-src/ext/wddx/php_wddx_api.h:1.25
--- php-src/ext/wddx/php_wddx_api.h:1.24        Sat Aug 13 21:17:49 2005
+++ php-src/ext/wddx/php_wddx_api.h     Wed Oct  5 18:35:11 2005
@@ -16,7 +16,7 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: php_wddx_api.h,v 1.24 2005/08/14 01:17:49 sniper Exp $ */
+/* $Id: php_wddx_api.h,v 1.25 2005/10/05 22:35:11 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.123&r2=1.124&ty=u
Index: php-src/ext/wddx/wddx.c
diff -u php-src/ext/wddx/wddx.c:1.123 php-src/ext/wddx/wddx.c:1.124
--- php-src/ext/wddx/wddx.c:1.123       Wed Aug 31 10:30:46 2005
+++ php-src/ext/wddx/wddx.c     Wed Oct  5 18:35:11 2005
@@ -16,7 +16,7 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: wddx.c,v 1.123 2005/08/31 14:30:46 sniper Exp $ */
+/* $Id: wddx.c,v 1.124 2005/10/05 22:35:11 rrichards Exp $ */
 
 #include "php.h"
 
@@ -423,7 +423,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);    
@@ -625,8 +625,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

Reply via email to