From 4e057b91576ce7be07c9f76ac9ab51b6e0b1fb15 Mon Sep 17 00:00:00 2001 From: usa Date: Fri, 27 Jun 2014 08:46:12 +0000 Subject: merge revision(s) 46098: [Backport #9861] * vsnprintf.c (BSD_vfprintf): fix string width when precision is given. as the result of `memchr` is NULL or its offset from the start cannot exceed the size, the comparison was always false. [ruby-core:62737] [Bug #9861] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_0_0@46582 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- vsnprintf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'vsnprintf.c') diff --git a/vsnprintf.c b/vsnprintf.c index 9778f039c5..929572a999 100644 --- a/vsnprintf.c +++ b/vsnprintf.c @@ -999,7 +999,7 @@ fp_begin: _double = va_arg(ap, double); */ const char *p = (char *)memchr(cp, 0, prec); - if (p != NULL && (p - cp) > prec) + if (p != NULL && (p - cp) < prec) size = (int)(p - cp); else size = prec; -- cgit v1.2.3