[s] Sanitizes text input/output in circuits (#32833)

* Adds Sanitization to TTS

* Sanitize input

* stripped_input

* strip debugger input

* Stripped inputs in pin inputs.

* stripped pin input

* stripped string pin input

* stripped char input pin.
This commit is contained in:
kevinz000
2017-11-16 22:36:18 -08:00
committed by CitadelStationBot
parent 2822e5820d
commit 8cf1266b72
7 changed files with 10 additions and 10 deletions
@@ -20,13 +20,13 @@
switch(type_to_use)
if("string")
accepting_refs = FALSE
new_data = input("Now type in a string.","[src] string writing") as null|text
new_data = stripped_input(user, "Now type in a string.","[src] string writing")
if(istext(new_data) && user.IsAdvancedToolUser())
data_to_write = new_data
to_chat(user, "<span class='notice'>You set \the [src]'s memory to \"[new_data]\".</span>")
if("number")
accepting_refs = FALSE
new_data = input("Now type in a number.","[src] number writing") as null|num
new_data = input(user, "Now type in a number.","[src] number writing") as null|num
if(isnum(new_data) && user.IsAdvancedToolUser())
data_to_write = new_data
to_chat(user, "<span class='notice'>You set \the [src]'s memory to [new_data].</span>")
@@ -108,7 +108,7 @@ a creative player the means to solve many problems. Circuits are held inside an
if(!check_interactivity(M))
return
var/input = reject_bad_name(input("What do you want to name this?", "Rename", src.name) as null|text,1)
var/input = reject_bad_name(stripped_input(M, "What do you want to name this?", "Rename", src.name),1)
if(src && input && check_interactivity(M))
to_chat(M, "<span class='notice'>The circuit '[src.name]' is now labeled '[input]'.</span>")
displayed_name = input
@@ -278,7 +278,7 @@ a creative player the means to solve many problems. Circuits are held inside an
var/new_data = null
switch(type_to_use)
if("string")
new_data = input("Now type in a string.","[src] string writing") as null|text
new_data = stripped_input(usr, "Now type in a string.","[src] string writing")
to_chat(usr, "<span class='notice'>You input [new_data] into the pin.</span>")
//to_chat(user, "<span class='notice'>You write '[new_data]' to the '[io]' pin of \the [io.holder].</span>")
if("number")
@@ -162,7 +162,7 @@ list[](
var/new_data = null
switch(type_to_use)
if("string")
new_data = input("Now type in a string.","[src] string writing", istext(default) ? default : null) as null|text
new_data = stripped_input(user, "Now type in a string.","[src] string writing", istext(default) ? default : null)
if(istext(new_data) && holder.check_interactivity(user) )
to_chat(user, "<span class='notice'>You input "+new_data+" into the pin.</span>")
return new_data
@@ -3,7 +3,7 @@
name = "char pin"
/datum/integrated_io/char/ask_for_pin_data(mob/user)
var/new_data = input("Please type in one character.","[src] char writing") as null|text
var/new_data = stripped_input(user, "Please type in one character.","[src] char writing")
if(holder.check_interactivity(user) )
to_chat(user, "<span class='notice'>You input [new_data ? "new_data" : "NULL"] into the pin.</span>")
write_data_to_pin(new_data)
@@ -24,4 +24,4 @@
push_data()
/datum/integrated_io/char/display_pin_type()
return IC_FORMAT_CHAR
return IC_FORMAT_CHAR
@@ -3,7 +3,7 @@
name = "string pin"
/datum/integrated_io/string/ask_for_pin_data(mob/user)
var/new_data = input("Please type in a string.","[src] string writing") as null|text
var/new_data = stripped_input(user, "Please type in a string.","[src] string writing")
if(holder.check_interactivity(user) )
to_chat(user, "<span class='notice'>You input [new_data ? "[new_data]" : "NULL"] into the pin.</span>")
write_data_to_pin(new_data)
@@ -70,7 +70,7 @@
power_draw_per_use = 4
/obj/item/integrated_circuit/input/textpad/ask_for_input(mob/user)
var/new_input = input(user, "Enter some words, please.","Number pad") as null|text
var/new_input = stripped_input(user, "Enter some words, please.","Number pad")
if(istext(new_input) && user.IsAdvancedToolUser())
set_pin_data(IC_OUTPUT, 1, new_input)
push_data()
@@ -142,7 +142,7 @@
text = get_pin_data(IC_INPUT, 1)
if(!isnull(text))
var/obj/O = assembly ? loc : assembly
O.say(strip_html_simple(text))
O.say(sanitize(text))
/obj/item/integrated_circuit/output/sound/Initialize()
.= ..()