Skip to content

Commit

Permalink
Should not use sizeof(buf) when buf is char*; #3701
Browse files Browse the repository at this point in the history
  • Loading branch information
matz committed Jun 16, 2017
1 parent a7770a3 commit 473b2bb
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion mrbgems/mruby-string-ext/src/string.c
Original file line number Diff line number Diff line change
Expand Up @@ -610,7 +610,7 @@ mrb_str_upto(mrb_state *mrb, mrb_value beg)

while (bi <= ei) {
if (excl && bi == ei) break;
snprintf(buf, sizeof(buf), "%.*d", min_width, bi);
snprintf(buf, max_width+1, "%.*d", (int)min_width, bi);
mrb_yield(mrb, block, mrb_str_new(mrb, buf, strlen(buf)));
mrb_gc_arena_restore(mrb, ai);
bi++;
Expand Down

0 comments on commit 473b2bb

Please sign in to comment.