aboutsummaryrefslogtreecommitdiffstats
path: root/sprintf.c
diff options
context:
space:
mode:
Diffstat (limited to 'sprintf.c')
-rw-r--r--sprintf.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/sprintf.c b/sprintf.c
index 1cb3c99d7c..16f9c35a3e 100644
--- a/sprintf.c
+++ b/sprintf.c
@@ -767,14 +767,11 @@ 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.
+ /* XXX - We cannot validiate the number of arguments if (digit)$ style used.
*/
- 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);