summaryrefslogtreecommitdiff
path: root/vsnprintf.c
diff options
context:
space:
mode:
authorusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-06-27 08:46:12 +0000
committerusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-06-27 08:46:12 +0000
commit4e057b91576ce7be07c9f76ac9ab51b6e0b1fb15 (patch)
tree2e7d498c2d55b039ef608f044febd827bde6267c /vsnprintf.c
parent1c8500b3d1a327ff4e56af3c9ed9164130becc74 (diff)
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
Diffstat (limited to 'vsnprintf.c')
-rw-r--r--vsnprintf.c2
1 files changed, 1 insertions, 1 deletions
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;