summaryrefslogtreecommitdiffhomepage
path: root/mrbgems/mruby-string-ext/src/string.c
diff options
context:
space:
mode:
authorYukihiro "Matz" Matsumoto <[email protected]>2017-06-16 11:42:51 +0900
committerYukihiro "Matz" Matsumoto <[email protected]>2017-06-16 11:42:51 +0900
commit473b2bb20df8e67cc3846c2ced8ea72513a477be (patch)
tree3baade40f68deb6bc6f6219155a8d2b1fd9b153f /mrbgems/mruby-string-ext/src/string.c
parenta7770a39aa4d59fd4fc973b42b9faa2a2b1cbd73 (diff)
downloadmruby-473b2bb20df8e67cc3846c2ced8ea72513a477be.tar.gz
mruby-473b2bb20df8e67cc3846c2ced8ea72513a477be.zip
Should not use `sizeof(buf)` when `buf` is `char*`; #3701
Diffstat (limited to 'mrbgems/mruby-string-ext/src/string.c')
-rw-r--r--mrbgems/mruby-string-ext/src/string.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/mrbgems/mruby-string-ext/src/string.c b/mrbgems/mruby-string-ext/src/string.c
index d52513026..138b9e3cf 100644
--- a/mrbgems/mruby-string-ext/src/string.c
+++ b/mrbgems/mruby-string-ext/src/string.c
@@ -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++;