Raised This Month: $12 Target: $400
 3% 

Execute command from a menu


Post New Thread Reply   
 
Thread Tools Display Modes
Cruze
Veteran Member
Join Date: May 2017
Old 12-29-2018 , 11:15   Re: Execute command from a menu
Reply With Quote #11

Quote:
Originally Posted by 1337norway View Post
DON'T EVER DO THIS!


Parsing a variable that a user can define into a ServerCommand function without sanitizing the string is very dangerous because it's exploitable. If the user set his name to ";quit" for example, the console command input would be "sm_hp ;quit", which would end the servers process. Or even worse they can have a name like ";rcon_password newpass" and the server will change the password so the attacker could have direct control over the server.
that was informative! Thanks!!
__________________
Taking paid private requests! Contact me
Cruze is offline
Powerlord
AlliedModders Donor
Join Date: Jun 2008
Location: Seduce Me!
Old 12-29-2018 , 17:47   Re: Execute command from a menu
Reply With Quote #12

If you are going to pass a user to another command, do it using their userid instead. Something like

PHP Code:
ServerCommand("sm_whatever #%d"GetClientUserId(client)); 
The # tells commands that use FindTarget / ProcessTargetString to treat the value that follows it as a userid.
__________________
Not currently working on SourceMod plugin development.
Powerlord is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 15:15.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode