From: Ilia Alshanetsky Date: Sun, 1 Feb 2009 19:42:48 +0000 (+0000) Subject: Fixed a possible invalid read when string is not null terminated X-Git-Tag: php-5.2.9RC1~11 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=e721d542eebdbf07331523c8d5cf1f7f30445ff4;p=php Fixed a possible invalid read when string is not null terminated --- diff --git a/main/spprintf.c b/main/spprintf.c index 704230d33d..aeecc6ca70 100644 --- a/main/spprintf.c +++ b/main/spprintf.c @@ -547,9 +547,11 @@ static void xbuf_format_converter(smart_str *xbuf, const char *fmt, va_list ap) 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;