Sanitizes Circuit Inputs

This commit is contained in:
Neerti
2017-11-17 18:26:05 -05:00
parent 2a55433ca9
commit 264372ff1a
3 changed files with 7 additions and 1 deletions

View File

@@ -112,6 +112,8 @@ list[](
/datum/integrated_io/proc/write_data_to_pin(var/new_data)
if(isnull(new_data) || isnum(new_data) || istext(new_data) || isweakref(new_data)) // Anything else is a type we don't want.
if(istext(new_data))
new_data = sanitizeSafe(new_data, MAX_MESSAGE_LEN, 0, 0)
data = new_data
holder.on_data_written()

View File

@@ -4,11 +4,14 @@
/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
if(holder.check_interactivity(user) )
new_data = sanitizeSafe(new_data, MAX_MESSAGE_LEN, 0, 0)
if(new_data && 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)
/datum/integrated_io/string/write_data_to_pin(var/new_data)
new_data = sanitizeSafe(new_data, MAX_MESSAGE_LEN, 0, 0)
if(isnull(new_data) || istext(new_data))
data = new_data
holder.on_data_written()

View File

@@ -125,6 +125,7 @@
if("string")
accepting_refs = 0
new_data = input("Now type in a string.","[src] string writing") as null|text
new_data = sanitizeSafe(new_data, MAX_MESSAGE_LEN, 0, 0)
if(istext(new_data) && CanInteract(user, physical_state))
data_to_write = new_data
to_chat(user, "<span class='notice'>You set \the [src]'s memory to \"[new_data]\".</span>")