mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-08-21 19:17:50 +01:00
Sanitized a large number of input()s.
- Hopefully this will cut down on the server spamming/crashing escapades happening on other servers. (This wont stop that from happening, this just makes it less severe) - Some of the sanitizes were probably unnecessary, but better safe then sorry. Added MAX_NAME_LEN constant which is initialized to 26. - Please use MAX_NAME_LEN instead of typing in 26 when cutting inputs short. 26's are annoying when they have to be changed and you have to hunt through over a hundred files and tens of thousands of lines of code to find them all. Moved uplink_kits.dm to code/game/objects/storage Moved uplinks.dm to code/game/objects - The stuff inside uplinks.dm could really be chopped up and split into separate dm files but this will do for now. ********************************************************* **********************Important************************** ********************************************************* When you create code that asks the user for an input consider whether or not it gets shown to the user through html or the like. If it does please sanatize() or strip_html() it. Also use copytext() to cutoff spam by using MAX_NAME_LEN and MAX_MESSAGE_LEN as the cutoff var. git-svn-id: http://tgstation13.googlecode.com/svn/trunk@3652 316c924e-a436-60f5-8080-3fe189b3f50e
This commit is contained in:
@@ -860,11 +860,10 @@ var/global/BSACooldown = 0
|
||||
if ((src.rank in list( "Trial Admin", "Badmin", "Game Admin", "Game Master" )))
|
||||
var/mob/M = locate(href_list["forcespeech"])
|
||||
if (ismob(M))
|
||||
var/speech = input("What will [key_name(M)] say?.", "Force speech", "")
|
||||
var/speech = copytext(sanitize(input("What will [key_name(M)] say?.", "Force speech", "")),1,MAX_MESSAGE_LEN)
|
||||
if(!speech)
|
||||
return
|
||||
M.say(speech)
|
||||
speech = copytext(sanitize(speech), 1, MAX_MESSAGE_LEN)
|
||||
log_admin("[key_name(usr)] forced [key_name(M)] to say: [speech]")
|
||||
message_admins("\blue [key_name_admin(usr)] forced [key_name_admin(M)] to say: [speech]")
|
||||
else
|
||||
@@ -1732,7 +1731,7 @@ var/global/BSACooldown = 0
|
||||
if(!ticker)
|
||||
alert("The game hasn't started yet!")
|
||||
return
|
||||
var/objective = input("Enter an objective")
|
||||
var/objective = copytext(sanitize(input("Enter an objective")),1,MAX_MESSAGE_LEN)
|
||||
if(!objective)
|
||||
return
|
||||
feedback_inc("admin_secrets_fun_used",1)
|
||||
|
||||
@@ -24,7 +24,7 @@ var/global/sent_strike_team = 0
|
||||
|
||||
var/input = null
|
||||
while(!input)
|
||||
input = input(src, "Please specify which mission the death commando squad shall undertake.", "Specify Mission", "")
|
||||
input = copytext(sanitize(input(src, "Please specify which mission the death commando squad shall undertake.", "Specify Mission", "")),1,MAX_MESSAGE_LEN)
|
||||
if(!input)
|
||||
if(alert("Error, no mission set. Do you want to exit the setup process?",,"Yes","No")=="Yes")
|
||||
return
|
||||
|
||||
@@ -24,7 +24,7 @@ var/global/sent_syndicate_strike_team = 0
|
||||
|
||||
var/input = null
|
||||
while(!input)
|
||||
input = input(src, "Please specify which mission the syndicate strike team shall undertake.", "Specify Mission", "")
|
||||
input = copytext(sanitize(input(src, "Please specify which mission the syndicate strike team shall undertake.", "Specify Mission", "")),1,MAX_MESSAGE_LEN)
|
||||
if(!input)
|
||||
if(alert("Error, no mission set. Do you want to exit the setup process?",,"Yes","No")=="Yes")
|
||||
return
|
||||
|
||||
@@ -47,10 +47,9 @@
|
||||
m_type = 1
|
||||
|
||||
if ("custom")
|
||||
var/input = input("Choose an emote to display.") as text|null
|
||||
var/input = copytext(sanitize(input("Choose an emote to display.") as text|null),1,MAX_MESSAGE_LEN)
|
||||
if (!input)
|
||||
return
|
||||
input = sanitize(input)
|
||||
var/input2 = input("Is this a visible or hearable emote?") in list("Visible","Hearable")
|
||||
if (input2 == "Visible")
|
||||
m_type = 1
|
||||
|
||||
@@ -56,10 +56,9 @@
|
||||
m_type = 2
|
||||
|
||||
if ("custom")
|
||||
var/input = input("Choose an emote to display.") as text|null
|
||||
var/input = copytext(sanitize(input("Choose an emote to display.") as text|null),1,MAX_MESSAGE_LEN)
|
||||
if (!input)
|
||||
return
|
||||
input = sanitize(input)
|
||||
var/input2 = input("Is this a visible or hearable emote?") in list("Visible","Hearable")
|
||||
if (input2 == "Visible")
|
||||
m_type = 1
|
||||
|
||||
@@ -391,16 +391,14 @@ datum/preferences
|
||||
|
||||
switch(link_tags["real_name"])
|
||||
if("input")
|
||||
new_name = input(user, "Please select a name:", "Character Generation") as text
|
||||
new_name = copytext( (input(user, "Please select a name:", "Character Generation") as text) ,1,MAX_NAME_LEN)
|
||||
var/list/bad_characters = list("_", "\"", "<", ">", ";", "\[", "\]", "{", "}", "|", "\\","0","1","2","3","4","5","6","7","8","9")
|
||||
for(var/c in bad_characters)
|
||||
new_name = dd_replacetext(new_name, c, "")
|
||||
|
||||
if(!new_name || (new_name == "Unknown") || (new_name == "floor") || (new_name == "wall") || (new_name == "r-wall"))
|
||||
alert("Invalid name. Don't do that!")
|
||||
return
|
||||
if(length(new_name) >= 26)
|
||||
alert("That name is too long.")
|
||||
return
|
||||
|
||||
//Carn: To fix BYOND text-parsing errors caused by people using dumb capitalisation in their names.
|
||||
var/tempname
|
||||
@@ -414,8 +412,6 @@ datum/preferences
|
||||
randomize_name()
|
||||
|
||||
if(new_name)
|
||||
if(length(new_name) >= 26)
|
||||
new_name = copytext(new_name, 1, 26)
|
||||
real_name = new_name
|
||||
|
||||
if(link_tags["age"])
|
||||
@@ -429,17 +425,9 @@ datum/preferences
|
||||
|
||||
if(link_tags["OOC"])
|
||||
var/tempnote = ""
|
||||
tempnote = input(user, "Please enter your OOC/ERP Notes!:", "OOC notes" , metadata) as text
|
||||
var/list/bad_characters = list("_", "\"", "<", ">", ";", "\[", "\]", "{", "}", "|", "\\","0","1","2","3","4","5","6","7","8","9")
|
||||
|
||||
for(var/c in bad_characters)
|
||||
tempnote = dd_replacetext(tempnote, c, "")
|
||||
|
||||
if(length(tempnote) >= 255)
|
||||
alert("That name is too long. (255 character max, please)")
|
||||
return
|
||||
|
||||
metadata = tempnote
|
||||
tempnote = copytext(sanitize(input(user, "Please enter your OOC Notes!:", "OOC notes" , metadata) as text),1,MAX_MESSAGE_LEN)
|
||||
if(tempnote)
|
||||
metadata = tempnote
|
||||
return
|
||||
|
||||
|
||||
@@ -493,9 +481,9 @@ datum/preferences
|
||||
if("random")
|
||||
randomize_skin_tone()
|
||||
if("input")
|
||||
var/new_tone = input(user, "Please select skin tone level: 1-220 (1=albino, 35=caucasian, 150=black, 220='very' black)", "Character Generation") as text
|
||||
var/new_tone = input(user, "Please select skin tone level: 1-220 (1=albino, 35=caucasian, 150=black, 220='very' black)", "Character Generation") as num
|
||||
if(new_tone)
|
||||
s_tone = max(min(round(text2num(new_tone)), 220), 1)
|
||||
s_tone = max(min(round(new_tone), 220), 1)
|
||||
s_tone = -s_tone + 35
|
||||
|
||||
if(link_tags["h_style"])
|
||||
|
||||
@@ -35,8 +35,7 @@
|
||||
user << "\blue You put the [W] into the folder."
|
||||
update_icon()
|
||||
else if(istype(W, /obj/item/weapon/pen))
|
||||
var/n_name = input(usr, "What would you like to label the folder?", "Folder Labelling", null) as text
|
||||
n_name = copytext(n_name, 1, 32)
|
||||
var/n_name = copytext(sanitize(input(usr, "What would you like to label the folder?", "Folder Labelling", null) as text),1,MAX_NAME_LEN)
|
||||
if ((loc == usr && usr.stat == 0))
|
||||
name = "folder[(n_name ? text("- '[n_name]'") : null)]"
|
||||
return
|
||||
|
||||
@@ -40,13 +40,10 @@
|
||||
if(mode)
|
||||
usr << "\blue You turn on the hand labeler."
|
||||
//Now let them chose the text.
|
||||
var/str = reject_bad_text(input(usr,"Label text?","Set label","")) //sanitize stuff! GOD DAMN THIS IS A SECURITY HOLE
|
||||
var/str = copytext(reject_bad_text(input(usr,"Label text?","Set label","")),1,MAX_NAME_LEN)
|
||||
if(!str || !length(str))
|
||||
usr << "\red Invalid text."
|
||||
return
|
||||
if(length(str) > 64)
|
||||
usr << "\red Text too long."
|
||||
return
|
||||
label = str
|
||||
usr << "\blue You set the text to '[str]'."
|
||||
else
|
||||
|
||||
@@ -62,8 +62,7 @@
|
||||
if ((usr.mutations & CLUMSY) && prob(50))
|
||||
usr << "\red You cut yourself on the paper."
|
||||
return
|
||||
var/n_name = input(usr, "What would you like to label the paper?", "Paper Labelling", null) as text
|
||||
n_name = copytext(n_name, 1, 32)
|
||||
var/n_name = copytext(sanitize(input(usr, "What would you like to label the paper?", "Paper Labelling", null) as text),1,MAX_NAME_LEN)
|
||||
if ((loc == usr && usr.stat == 0))
|
||||
name = "paper[(n_name ? text("- '[n_name]'") : null)]"
|
||||
add_fingerprint(usr)
|
||||
|
||||
@@ -26,8 +26,7 @@
|
||||
M << "\red You don't feel cool enough to name this gun, chump."
|
||||
return 0
|
||||
|
||||
var/input = input("What do you want to name the gun?",,"")
|
||||
input = sanitize(input)
|
||||
var/input = copytext(sanitize(input("What do you want to name the gun?",,"")),1,MAX_NAME_LEN)
|
||||
|
||||
if(src && input && !M.stat && in_range(M,src))
|
||||
name = input
|
||||
|
||||
@@ -24,17 +24,13 @@
|
||||
user << "\blue *TAGGED*"
|
||||
src.sortTag = O.currTag
|
||||
else if(istype(W, /obj/item/weapon/pen))
|
||||
var/str = input(usr,"Label text?","Set label","")
|
||||
var/str = copytext(sanitize(input(usr,"Label text?","Set label","")),1,MAX_NAME_LEN)
|
||||
if(!str || !length(str))
|
||||
usr << "\red Invalid text."
|
||||
return
|
||||
if(length(str) > 64)
|
||||
usr << "\red Text too long."
|
||||
return
|
||||
var/label = str
|
||||
for(var/mob/M in viewers())
|
||||
M << "\blue [user] labels [src] as [label]."
|
||||
src.name = "[src.name] ([label])"
|
||||
M << "\blue [user] labels [src] as [str]."
|
||||
src.name = "[src.name] ([str])"
|
||||
return
|
||||
|
||||
/obj/item/smallDelivery
|
||||
@@ -64,17 +60,13 @@
|
||||
user << "\blue *TAGGED*"
|
||||
src.sortTag = O.currTag
|
||||
else if(istype(W, /obj/item/weapon/pen))
|
||||
var/str = input(usr,"Label text?","Set label","")
|
||||
var/str = copytext(sanitize(input(usr,"Label text?","Set label","")),1,MAX_NAME_LEN)
|
||||
if(!str || !length(str))
|
||||
usr << "\red Invalid text."
|
||||
return
|
||||
if(length(str) > 64)
|
||||
usr << "\red Text too long."
|
||||
return
|
||||
var/label = str
|
||||
for(var/mob/M in viewers())
|
||||
M << "\blue [user] labels [src] as [label]."
|
||||
src.name = "[src.name] ([label])"
|
||||
M << "\blue [user] labels [src] as [str]."
|
||||
src.name = "[src.name] ([str])"
|
||||
return
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user