summaryrefslogtreecommitdiff
path: root/sprintf.c
diff options
context:
space:
mode:
Diffstat (limited to 'sprintf.c')
-rw-r--r--sprintf.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/sprintf.c b/sprintf.c
index 98db29ea6c..38283919e6 100644
--- a/sprintf.c
+++ b/sprintf.c
@@ -770,14 +770,12 @@ rb_f_sprintf(argc, argv)
}
sprint_exit:
-#if 0
/* XXX - We cannot validiate the number of arguments because
* the format string may contain `n$'-style argument selector.
*/
- if (RTEST(ruby_verbose) && nextarg < argc) {
+ if (RTEST(ruby_verbose) && posarg >= 0 && nextarg < argc) {
rb_raise(rb_eArgError, "too many arguments for format string");
}
-#endif
rb_str_resize(result, blen);
if (tainted) OBJ_TAINT(result);