mirror of
https://github.com/ruby/ruby.git
synced 2025-09-16 09:04:05 +02:00
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
This commit is contained in:
parent
8a33324477
commit
0caeba64c3
5 changed files with 30 additions and 7 deletions
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue