diff options
author | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 1999-12-06 09:04:03 +0000 |
---|---|---|
committer | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 1999-12-06 09:04:03 +0000 |
commit | 0ca799d43c24ec0ce26d59e4fabcc5a092eec9c7 (patch) | |
tree | cd2c1ec91ad57702c5b466ae2012cf957431b3d3 /sprintf.c | |
parent | cb4d9ccf0322f5cec3e6fc16abc2925d50f14595 (diff) |
19991206
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_4@576 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'sprintf.c')
-rw-r--r-- | sprintf.c | 6 |
1 files changed, 5 insertions, 1 deletions
@@ -147,12 +147,13 @@ rb_f_sprintf(argc, argv) char *buf, *p, *end; int blen, bsiz; VALUE result; - int width, prec, flags = FNONE; + int tainted = 0; VALUE tmp; VALUE str; fmt = GETARG(); + if (OBJ_TAINTED(fmt)) tainted = 1; p = str2cstr(fmt, &blen); end = p + blen; blen = 0; @@ -172,6 +173,7 @@ rb_f_sprintf(argc, argv) p = t + 1; /* skip `%' */ width = prec = -1; + retry: switch (*p) { default: @@ -290,6 +292,7 @@ rb_f_sprintf(argc, argv) int len; str = rb_obj_as_string(arg); + if (OBJ_TAINTED(str)) tainted = 1; len = RSTRING(str)->len; if (flags&FPREC) { if (prec < len) { @@ -618,6 +621,7 @@ rb_f_sprintf(argc, argv) result = rb_str_new(buf, blen); free(buf); + if (tainted) OBJ_TAINT(result); return result; } |