diff options
| author | Yukihiro "Matz" Matsumoto <[email protected]> | 2017-03-11 15:18:41 +0900 |
|---|---|---|
| committer | Yukihiro "Matz" Matsumoto <[email protected]> | 2017-03-11 15:18:41 +0900 |
| commit | e3922318bd2679de7930ba7c520d58961340e006 (patch) | |
| tree | 645dd284c3f13df97afa091e3aecbfaaaa0a3807 /mrbgems/mruby-sprintf | |
| parent | f9ed15d899edaa2393ea4d07c7862746cdfa06fc (diff) | |
| download | mruby-e3922318bd2679de7930ba7c520d58961340e006.tar.gz mruby-e3922318bd2679de7930ba7c520d58961340e006.zip | |
Check return value from snprintf(); ref #3498
Diffstat (limited to 'mrbgems/mruby-sprintf')
| -rw-r--r-- | mrbgems/mruby-sprintf/src/sprintf.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/mrbgems/mruby-sprintf/src/sprintf.c b/mrbgems/mruby-sprintf/src/sprintf.c index d02a2aa4d..a3e20d83a 100644 --- a/mrbgems/mruby-sprintf/src/sprintf.c +++ b/mrbgems/mruby-sprintf/src/sprintf.c @@ -1087,6 +1087,9 @@ retry: CHECK(need); n = snprintf(&buf[blen], need, fbuf, fval); + if (n < 0) { + mrb_raise(mrb, E_RUNTIME_ERROR, "formatting error"); + } blen += n; } break; |
