Skip to content
Permalink
Browse files
Check return value from snprintf(); ref #3498
  • Loading branch information
matz committed Mar 11, 2017
1 parent f9ed15d commit e3922318bd2679de7930ba7c520d58961340e006
Showing 1 changed file with 3 additions and 0 deletions.
@@ -1087,6 +1087,9 @@ mrb_str_format(mrb_state *mrb, int argc, const mrb_value *argv, mrb_value fmt)

CHECK(need);
n = snprintf(&buf[blen], need, fbuf, fval);
if (n < 0) {
mrb_raise(mrb, E_RUNTIME_ERROR, "formatting error");
}
blen += n;
}
break;

0 comments on commit e392231

Please sign in to comment.