[Bug #20438] Disallow "%\n" and "%\0"

This commit is contained in:
Nobuyoshi Nakada 2024-05-28 23:19:33 +09:00
parent 61e2916d1c
commit 31c9a3a1d3
3 changed files with 51 additions and 33 deletions

View file

@ -429,10 +429,6 @@ rb_str_format(int argc, const VALUE *argv, VALUE fmt)
GETNUM(prec, precision);
goto retry;
case '\n':
case '\0':
p--;
/* fall through */
case '%':
if (flags != FNONE) {
rb_raise(rb_eArgError, "invalid format character - %%");