tony2001 Fri Jan 26 15:33:18 2007 UTC Modified files: (Branch: PHP_5_2) /php-src/ext/standard info.c Log: use length - 1 when we fetch it from hashes http://cvs.php.net/viewvc.cgi/php-src/ext/standard/info.c?r1=1.249.2.10.2.8&r2=1.249.2.10.2.9&diff_format=u Index: php-src/ext/standard/info.c diff -u php-src/ext/standard/info.c:1.249.2.10.2.8 php-src/ext/standard/info.c:1.249.2.10.2.9 --- php-src/ext/standard/info.c:1.249.2.10.2.8 Mon Jan 1 09:36:08 2007 +++ php-src/ext/standard/info.c Fri Jan 26 15:33:18 2007 @@ -18,7 +18,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: info.c,v 1.249.2.10.2.8 2007/01/01 09:36:08 sebastian Exp $ */ +/* $Id: info.c,v 1.249.2.10.2.9 2007/01/26 15:33:18 tony2001 Exp $ */ #include "php.h" #include "php_ini.h" @@ -509,10 +509,10 @@ zend_hash_get_current_key_ex(url_stream_wrappers_hash, &stream_protocol, (uint *)&stream_protocol_len, &num_key, 0, NULL) == HASH_KEY_IS_STRING; zend_hash_move_forward(url_stream_wrappers_hash)) { stream_protocols_buf = erealloc(stream_protocols_buf, stream_protocols_buf_len + stream_protocol_len + 2 + 1); - memcpy(stream_protocols_buf + stream_protocols_buf_len, stream_protocol, stream_protocol_len); - stream_protocols_buf[stream_protocols_buf_len + stream_protocol_len] = ','; - stream_protocols_buf[stream_protocols_buf_len + stream_protocol_len + 1] = ' '; - stream_protocols_buf_len += stream_protocol_len + 2; + memcpy(stream_protocols_buf + stream_protocols_buf_len, stream_protocol, stream_protocol_len - 1); + stream_protocols_buf[stream_protocols_buf_len + stream_protocol_len - 1] = ','; + stream_protocols_buf[stream_protocols_buf_len + stream_protocol_len] = ' '; + stream_protocols_buf_len += stream_protocol_len + 1; } if (stream_protocols_buf) { stream_protocols_buf[stream_protocols_buf_len - 2] = ' '; @@ -539,8 +539,8 @@ for(zend_hash_internal_pointer_reset(stream_xport_hash); zend_hash_get_current_key_ex(stream_xport_hash, &xport_name, (uint *)&xport_name_len, &num_key, 0, NULL) == HASH_KEY_IS_STRING; zend_hash_move_forward(stream_xport_hash)) { - if (xport_buf_len + xport_name_len + 3 > xport_buf_size) { - while (xport_buf_len + xport_name_len + 3 > xport_buf_size) { + if (xport_buf_len + xport_name_len + 2 > xport_buf_size) { + while (xport_buf_len + xport_name_len + 2 > xport_buf_size) { xport_buf_size += 256; } if (xport_buf) { @@ -553,8 +553,8 @@ xport_buf[xport_buf_len++] = ','; xport_buf[xport_buf_len++] = ' '; } - memcpy(xport_buf + xport_buf_len, xport_name, xport_name_len); - xport_buf_len += xport_name_len; + memcpy(xport_buf + xport_buf_len, xport_name, xport_name_len - 1); + xport_buf_len += xport_name_len - 1; xport_buf[xport_buf_len] = '\0'; } if (xport_buf) { @@ -580,8 +580,8 @@ for(zend_hash_internal_pointer_reset(stream_filter_hash); zend_hash_get_current_key_ex(stream_filter_hash, &filter_name, (uint *)&filter_name_len, &num_key, 0, NULL) == HASH_KEY_IS_STRING; zend_hash_move_forward(stream_filter_hash)) { - if (filter_buf_len + filter_name_len + 3 > filter_buf_size) { - while (filter_buf_len + filter_name_len + 3 > filter_buf_size) { + if (filter_buf_len + filter_name_len + 2 > filter_buf_size) { + while (filter_buf_len + filter_name_len + 2 > filter_buf_size) { filter_buf_size += 256; } if (filter_buf) { @@ -594,8 +594,8 @@ filter_buf[filter_buf_len++] = ','; filter_buf[filter_buf_len++] = ' '; } - memcpy(filter_buf + filter_buf_len, filter_name, filter_name_len); - filter_buf_len += filter_name_len; + memcpy(filter_buf + filter_buf_len, filter_name, filter_name_len - 1); + filter_buf_len += filter_name_len - 1; filter_buf[filter_buf_len] = '\0'; } if (filter_buf) {
-- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php