com php-src: Fix precision handling in strings: phpdbg_utils .c
| From: | Bob Weinand | Date: | Sun, 05 Oct 2014 09:57:14 +0000 |
| Subject: | com php-src: Fix precision handling in strings: phpdbg_utils .c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-82606@lists.php.net to get a copy of this message | ||
Commit: 9cc73b5c75e4951e3d06c11412b318790c814275
Author: Bob Weinand <bobwei9@hotmail.com> Sun, 5 Oct 2014 11:57:14 +0200
Parents: 7911b6405c0b1e646509a68760c0929ec811e4c5
Branches: PHP-5.6
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=9cc73b5c75e4951e3d06c11412b318790c814275
Log:
Fix precision handling in strings
Changed paths:
M phpdbg_utils.c
Diff:
diff --git a/phpdbg_utils.c b/phpdbg_utils.c
index bec222e..1151f3f 100644
--- a/phpdbg_utils.c
+++ b/phpdbg_utils.c
@@ -435,7 +435,7 @@ static int format_converter(register buffy *odp, const char *fmt, zend_bool esca
} else
precision = 0;
- if (precision > FORMAT_CONV_MAX_PRECISION) {
+ if (precision > FORMAT_CONV_MAX_PRECISION && *fmt != 's' && *fmt
!= 'v' && *fmt != 'b') {
precision = FORMAT_CONV_MAX_PRECISION;
}
} else
@@ -705,10 +705,10 @@ static int format_converter(register buffy *odp, const char *fmt, zend_bool
esca
case 'v':
s = va_arg(ap, char *);
if (s != NULL) {
- s_len = strlen(s);
-
- if (adjust_precision && precision < s_len) {
+ if (adjust_precision) {
s_len = precision;
+ } else {
+ s_len = strlen(s);
}
if (escape_xml) {
@@ -760,7 +760,7 @@ static int format_converter(register buffy *odp, const char *fmt, zend_bool esca
s_len = PHPDBG_G(err_buf).msglen;
}
- if (adjust_precision && precision < s_len) {
+ if (adjust_precision && precision != s_len) {
s_len = precision;
}
} else {