TG: 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.
Revision: r3652
Author: 	 johnsonmt88
This commit is contained in:
Erthilo
2012-05-26 00:09:56 +01:00
parent ca62d85b83
commit 6e289dabfc
40 changed files with 627 additions and 164 deletions
+1 -1
View File
@@ -220,7 +220,7 @@
if (istype(W, /obj/item/weapon/pen))
var/t = input(user, "Enter new robot name", src.name, src.created_name) as text
t = copytext(sanitize(t), 1, MAX_MESSAGE_LEN)
t = copytext(sanitize(t), 1, MAX_NAME_LEN)
if (!t)
return
if (!in_range(src, usr) && src.loc != usr)
+10 -10
View File
@@ -91,8 +91,8 @@ AI MODULES
/obj/item/weapon/aiModule/safeguard/attack_self(var/mob/user as mob)
..()
var/targName = input(usr, "Please enter the name of the person to safeguard.", "Safeguard who?", user.name)
targetName = sanitize(targName)
var/targName = copytext(sanitize(input(usr, "Please enter the name of the person to safeguard.", "Safeguard who?", user.name)),1,MAX_MESSAGE_LEN)
targetName = targName
desc = text("A 'safeguard' AI module: 'Safeguard []. Individuals that threaten [] are not crew and are a threat to crew.'", targetName, targetName)
/obj/item/weapon/aiModule/safeguard/transmitInstructions(var/mob/living/silicon/ai/target, var/mob/sender)
@@ -114,8 +114,8 @@ AI MODULES
/obj/item/weapon/aiModule/oneHuman/attack_self(var/mob/user as mob)
..()
var/targName = input(usr, "Please enter the name of the person who is the only crewmember.", "Who?", user.real_name)
targetName = sanitize(targName)
var/targName = copytext(sanitize(input(usr, "Please enter the name of the person who is the only human.", "Who?", user.real_name)),1,MAX_MESSAGE_LEN)
targetName = targName
desc = text("A 'one crewmember' AI module: 'Only [] is crewmember.'", targetName)
/obj/item/weapon/aiModule/oneHuman/transmitInstructions(var/mob/living/silicon/ai/target, var/mob/sender)
@@ -247,8 +247,8 @@ AI MODULES
lawpos = input("Please enter the priority for your new law. Can only write to law sectors 15 and above.", "Law Priority (15+)", lawpos) as num
lawpos = min(lawpos, 50)
var/newlaw = ""
var/targName = input(usr, "Please enter a new law for the AI.", "Freeform Law Entry", newlaw)
newFreeFormLaw = sanitize(targName)
var/targName = copytext(sanitize(input(usr, "Please enter a new law for the AI.", "Freeform Law Entry", newlaw)),1,MAX_MESSAGE_LEN)
newFreeFormLaw = targName
desc = "A 'freeform' AI module: ([lawpos]) '[newFreeFormLaw]'"
/obj/item/weapon/aiModule/freeform/transmitInstructions(var/mob/living/silicon/ai/target, var/mob/sender)
@@ -390,8 +390,8 @@ AI MODULES
/obj/item/weapon/aiModule/freeformcore/attack_self(var/mob/user as mob)
..()
var/newlaw = ""
var/targName = input(usr, "Please enter a new core law for the AI.", "Freeform Law Entry", newlaw)
newFreeFormLaw = sanitize(targName)
var/targName = copytext(sanitize(input(usr, "Please enter a new core law for the AI.", "Freeform Law Entry", newlaw)),1,MAX_MESSAGE_LEN)
newFreeFormLaw = targName
desc = "A 'freeform' Core AI module: '[newFreeFormLaw]'"
/obj/item/weapon/aiModule/freeformcore/transmitInstructions(var/mob/living/silicon/ai/target, var/mob/sender)
@@ -411,8 +411,8 @@ AI MODULES
/obj/item/weapon/aiModule/syndicate/attack_self(var/mob/user as mob)
..()
var/newlaw = ""
var/targName = input(usr, "Please enter a new law for the AI.", "Freeform Law Entry", newlaw)
newFreeFormLaw = sanitize(targName)
var/targName = copytext(sanitize(input(usr, "Please enter a new law for the AI.", "Freeform Law Entry", newlaw)),1,MAX_MESSAGE_LEN)
newFreeFormLaw = targName
desc = "A hacked AI law module: '[newFreeFormLaw]'"
/obj/item/weapon/aiModule/syndicate/transmitInstructions(var/mob/living/silicon/ai/target, var/mob/sender)
@@ -1,5 +1,7 @@
/obj/item/weapon/plastique/attack_self(mob/user as mob)
var/newtime = input(usr, "Please set the timer.", "Timer", 10)
var/newtime = input(usr, "Please set the timer.", "Timer", 10) as num
if(newtime < 1)
newtime = 10
timer = newtime
user << "Timer set for [timer] seconds."
@@ -222,8 +222,7 @@ PHOTOGRAPHS
/obj/item/weapon/paper/photograph/attack_self(mob/user as mob)
var/n_name = input(user, "What would you like to label the photo?", "Paper Labelling", null) as text
n_name = copytext(n_name, 1, 32)
var/n_name = copytext(sanitize(input(user, "What would you like to label the photo?", "Paper Labelling", null) as text),1,32)
if ((src.loc == user && user.stat == 0))
src.name = text("photo[]", (n_name ? text("- '[]'", n_name) : null))
src.add_fingerprint(user)