Permalink
Browse files

Check if width is zero or negative before fill; fix #3347

  • Loading branch information...
matz committed Dec 17, 2016
1 parent 2edf15b commit 432570723d027313f0d8dd5d3724fbc53f160e5c
Showing with 2 additions and 2 deletions.
  1. +2 −2 mrbgems/mruby-sprintf/src/sprintf.c
@@ -720,10 +720,10 @@ mrb_str_format(mrb_state *mrb, int argc, const mrb_value *argv, mrb_value fmt)
CHECK(n);
memcpy(buf+blen, c, n);
blen += n;
FILL(' ', width-1);
if (width>0) FILL(' ', width-1);
}
else {
FILL(' ', width-1);
if (width>0) FILL(' ', width-1);
CHECK(n);
memcpy(buf+blen, c, n);
blen += n;

0 comments on commit 4325707

Please sign in to comment.