This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

Spliting arguments

Help for those learning Tcl or writing their own scripts.
Post Reply
h
honeybee
Halfop
Posts: 80
Joined: Sun Jan 01, 2006 12:42 pm

Spliting arguments

Post by honeybee »

I'm using a public command tcl, though i have splited the argument
example: [lrange [split $arg] 1 end]

but still if someone use reason with special chars like [ or \ the reason appeared to be
like: {[/z]} {}) or {[whatever reason with brackets]})
, which is surely a security whole.
[/quote]
User avatar
De Kus
Revered One
Posts: 1361
Joined: Sun Dec 15, 2002 11:41 am
Location: Germany

Post by De Kus »

Security wholes you only make yourself. If properly used it doesnt matter which bytes they use. Split is doing its job well... if needed. The thing you probably wanted to do is:
[join [lrange [split $arg] 1 end]]
or equivalent one:
[join [lreplace [split $arg] 0 0]]
or without any list functions:
[string range $arg [expr {[string first " " $arg] + 1}] end]
De Kus
StarZ|De_Kus, De_Kus or DeKus on IRC
Copyright © 2005-2009 by De Kus - published under The MIT License
Love hurts, love strengthens...
Post Reply