summaryrefslogtreecommitdiff
path: root/sprintf.c
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>1999-12-06 09:04:03 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>1999-12-06 09:04:03 +0000
commitdee96209bfbb957538c7adeb01a65f3830749179 (patch)
tree3289aa4829f7fcb044cfa70341caaafd1aa086b0 /sprintf.c
parent4263bb432accd9bd98654c3e8cc312414e7db906 (diff)
19991206
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@576 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'sprintf.c')
-rw-r--r--sprintf.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/sprintf.c b/sprintf.c
index 5bfd403..5badb61 100644
--- a/sprintf.c
+++ b/sprintf.c
@@ -172,10 +172,12 @@ rb_f_sprintf(argc, argv)
int width, prec, flags = FNONE;
int nextarg = 0;
+ int tainted = 0;
VALUE tmp;
VALUE str;
fmt = GETARG();
+ if (OBJ_TAINTED(fmt)) tainted = 1;
p = str2cstr(fmt, &blen);
end = p + blen;
blen = 0;
@@ -318,6 +320,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) {
@@ -651,6 +654,7 @@ rb_f_sprintf(argc, argv)
result = rb_str_new(buf, blen);
free(buf);
+ if (tainted) OBJ_TAINT(result);
return result;
}