cvs: php-src(PHP_5_2) /main spprintf.c
| From: | Ilia Alshanetsky | Date: | Sun, 01 Feb 2009 19:42:48 +0000 |
| Subject: | cvs: php-src(PHP_5_2) /main spprintf.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-56056@lists.php.net to get a copy of this message | ||
iliaa Sun Feb 1 19:42:48 2009 UTC
Modified files: (Branch: PHP_5_2)
/php-src/main spprintf.c
Log:
Fixed a possible invalid read when string is not null terminated
http://cvs.php.net/viewvc.cgi/php-src/main/spprintf.c?r1=1.25.2.2.2.13&r2=1.25.2.2.2.14&diff_format=u
Index: php-src/main/spprintf.c
diff -u php-src/main/spprintf.c:1.25.2.2.2.13 php-src/main/spprintf.c:1.25.2.2.2.14
--- php-src/main/spprintf.c:1.25.2.2.2.13 Wed Dec 31 11:17:48 2008
+++ php-src/main/spprintf.c Sun Feb 1 19:42:48 2009
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: spprintf.c,v 1.25.2.2.2.13 2008/12/31 11:17:48 sebastian Exp $ */
+/* $Id: spprintf.c,v 1.25.2.2.2.14 2009/02/01 19:42:48 iliaa Exp $ */
/* This is the spprintf implementation.
* It has emerged from apache snprintf. See original header:
@@ -547,9 +547,11 @@
case 'v':
s = va_arg(ap, char *);
if (s != NULL) {
- s_len = strlen(s);
- if (adjust_precision && precision < s_len)
+ if (adjust_precision && precision) {
s_len = precision;
+ } else {
+ s_len = strlen(s);
+ }
} else {
s = S_NULL;
s_len = S_NULL_LEN;