Skip to content

Commit c8c94bf

Browse files
committed
Fix benign off-by-one
Previously we always reserved one more byte than necessary in the sprintf output string.
1 parent 1f6dd90 commit c8c94bf

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

sprintf.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,8 @@ sign_bits(int base, const char *p)
6767

6868
#define CHECK(l) do {\
6969
int cr = ENC_CODERANGE(result);\
70-
while ((l) >= bsiz - blen) {\
70+
RUBY_ASSERT(bsiz >= blen); \
71+
while ((l) > bsiz - blen) {\
7172
bsiz*=2;\
7273
if (bsiz<0) rb_raise(rb_eArgError, "too big specifier");\
7374
}\

0 commit comments

Comments
 (0)