1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

tcltklib.c :

* Tk interpreter returns TAINTED strings.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3968 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nagai 2003-06-20 14:52:45 +00:00
parent f289fddace
commit ff75ab3e3c
2 changed files with 12 additions and 7 deletions

View file

@ -635,7 +635,8 @@ ip_eval(self, str)
DUMP2("(TCL_Eval result) %d", ptr->return_value); DUMP2("(TCL_Eval result) %d", ptr->return_value);
/* pass back the result (as string) */ /* pass back the result (as string) */
return(rb_str_new2(ptr->ip->result)); /* return(rb_str_new2(ptr->ip->result)); */
return(rb_tainted_str_new2(ptr->ip->result));
} }
@ -665,7 +666,8 @@ ip_toUTF8(self, str, encodename)
Tcl_DStringInit(&dstr); Tcl_DStringInit(&dstr);
Tcl_DStringFree(&dstr); Tcl_DStringFree(&dstr);
Tcl_ExternalToUtfDString(encoding,buf,strlen(buf),&dstr); Tcl_ExternalToUtfDString(encoding,buf,strlen(buf),&dstr);
str = rb_str_new2(Tcl_DStringValue(&dstr)); /* str = rb_str_new2(Tcl_DStringValue(&dstr)); */
str = rb_tainted_str_new2(Tcl_DStringValue(&dstr));
Tcl_FreeEncoding(encoding); Tcl_FreeEncoding(encoding);
Tcl_DStringFree(&dstr); Tcl_DStringFree(&dstr);
@ -699,7 +701,8 @@ ip_fromUTF8(self, str, encodename)
Tcl_DStringInit(&dstr); Tcl_DStringInit(&dstr);
Tcl_DStringFree(&dstr); Tcl_DStringFree(&dstr);
Tcl_UtfToExternalDString(encoding,buf,strlen(buf),&dstr); Tcl_UtfToExternalDString(encoding,buf,strlen(buf),&dstr);
str = rb_str_new2(Tcl_DStringValue(&dstr)); /* str = rb_str_new2(Tcl_DStringValue(&dstr)); */
str = rb_tainted_str_new2(Tcl_DStringValue(&dstr));
Tcl_FreeEncoding(encoding); Tcl_FreeEncoding(encoding);
Tcl_DStringFree(&dstr); Tcl_DStringFree(&dstr);
@ -796,7 +799,8 @@ ip_invoke_real(argc, argv, obj)
} }
/* pass back the result (as string) */ /* pass back the result (as string) */
return rb_str_new2(ptr->ip->result); /* return rb_str_new2(ptr->ip->result); */
return rb_tainted_str_new2(ptr->ip->result);
} }
VALUE VALUE

View file

@ -847,13 +847,14 @@ module TkCore
args.flatten! args.flatten!
print "=> ", args.join(" ").inspect, "\n" if $DEBUG print "=> ", args.join(" ").inspect, "\n" if $DEBUG
begin begin
res = INTERP._invoke(*args) # res = INTERP._invoke(*args).taint
res = INTERP._invoke(*args) # _invoke returns a TAITED string
rescue NameError rescue NameError
err = $! err = $!
begin begin
args.unshift "unknown" args.unshift "unknown"
#res = INTERP._invoke(*args) #res = INTERP._invoke(*args).taint
res = INTERP._invoke(*args).taint res = INTERP._invoke(*args) # _invoke returns a TAITED string
rescue rescue
fail unless /^invalid command/ =~ $! fail unless /^invalid command/ =~ $!
fail err fail err