summaryrefslogtreecommitdiff
path: root/vsnprintf.c
diff options
context:
space:
mode:
authornagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-06-29 17:17:20 +0000
committernagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-06-29 17:17:20 +0000
commit0caeba64c30e6746870328a0d7da6250b0a3773c (patch)
tree4ebfc8e4bbebbdc612920a14cd5f5719ce99f030 /vsnprintf.c
parent8a33324477d9ba0b7dd8fd28a6927e89580664e6 (diff)
merge revision(s) r46098: [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_1@46611 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 5266927d7f..f272d73337 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;