From ea8e84846342ca36f7dfda53ad4bf2b035f4d3e0 Mon Sep 17 00:00:00 2001 From: volas Date: Sun, 1 Feb 2015 23:16:04 +0300 Subject: [PATCH] copytext() check for some input --- code/game/dna/dna_modifier.dm | 2 +- code/modules/mob/living/carbon/human/human_powers.dm | 2 +- code/modules/paperwork/photography.dm | 3 +-- code/modules/projectiles/ammunition.dm | 2 +- code/modules/reagents/Chemistry-Machinery.dm | 2 +- code/modules/reagents/reagent_containers/glass.dm | 2 +- code/unused/hivebot/emote.dm | 3 +-- 7 files changed, 7 insertions(+), 9 deletions(-) diff --git a/code/game/dna/dna_modifier.dm b/code/game/dna/dna_modifier.dm index 322e65202f9..53086de2522 100644 --- a/code/game/dna/dna_modifier.dm +++ b/code/game/dna/dna_modifier.dm @@ -737,7 +737,7 @@ if (bufferOption == "changeLabel") var/datum/dna2/record/buf = src.buffers[bufferId] - var/text = sanitize(input(usr, "New Label:", "Edit Label", buf.name) as text|null) + var/text = sanitize(copytext(input(usr, "New Label:", "Edit Label", buf.name) as text|null, 1, MAX_NAME_LEN)) buf.name = text src.buffers[bufferId] = buf return 1 diff --git a/code/modules/mob/living/carbon/human/human_powers.dm b/code/modules/mob/living/carbon/human/human_powers.dm index 87da63c7f20..1150a52e717 100644 --- a/code/modules/mob/living/carbon/human/human_powers.dm +++ b/code/modules/mob/living/carbon/human/human_powers.dm @@ -213,7 +213,7 @@ set desc = "Whisper silently to someone over a distance." set category = "Abilities" - var/msg = sanitize(input("Message:", "Psychic Whisper") as text|null) + var/msg = sanitize(copytext(input("Message:", "Psychic Whisper") as text|null, 1, MAX_MESSAGE_LEN)) if(msg) log_say("PsychicWhisper: [key_name(src)]->[M.key] : [msg]") M << "\green You hear a strange, alien voice in your head... \italic [msg]" diff --git a/code/modules/paperwork/photography.dm b/code/modules/paperwork/photography.dm index 1f2d45e77da..34a974064e7 100644 --- a/code/modules/paperwork/photography.dm +++ b/code/modules/paperwork/photography.dm @@ -43,8 +43,7 @@ var/global/photo_count = 0 /obj/item/weapon/photo/attackby(obj/item/weapon/P as obj, mob/user as mob) if(istype(P, /obj/item/weapon/pen) || istype(P, /obj/item/toy/crayon)) - var/txt = sanitize(input(user, "What would you like to write on the back?", "Photo Writing", null) as text) - txt = copytext(txt, 1, 128) + var/txt = sanitize(copytext(input(user, "What would you like to write on the back?", "Photo Writing", null) as text, 1, 128)) if(loc == user && user.stat == 0) scribble = txt ..() diff --git a/code/modules/projectiles/ammunition.dm b/code/modules/projectiles/ammunition.dm index 4f149fe3012..9220f847b9a 100644 --- a/code/modules/projectiles/ammunition.dm +++ b/code/modules/projectiles/ammunition.dm @@ -26,7 +26,7 @@ if(BB) if(initial(BB.name) == "bullet") var/tmp_label = "" - var/label_text = sanitize(input(user, "Inscribe some text into \the [initial(BB.name)]","Inscription",tmp_label)) + var/label_text = sanitize(copytext(input(user, "Inscribe some text into \the [initial(BB.name)]","Inscription",tmp_label), 1, MAX_NAME_LEN)) if(length(label_text) > 20) user << "\red The inscription can be at most 20 characters long." else diff --git a/code/modules/reagents/Chemistry-Machinery.dm b/code/modules/reagents/Chemistry-Machinery.dm index a2ea7c6f0c0..7f754e56b37 100644 --- a/code/modules/reagents/Chemistry-Machinery.dm +++ b/code/modules/reagents/Chemistry-Machinery.dm @@ -646,7 +646,7 @@ if(type in diseases) // Make sure this is a disease D = new type(0, null) var/list/data = list("viruses"=list(D)) - var/name = sanitize(input(usr,"Name:","Name the culture",D.name)) + var/name = sanitize(copytext(input(usr,"Name:","Name the culture",D.name), 1, MAX_NAME_LEN)) if(!name || name == " ") name = D.name B.name = "[name] culture bottle" B.desc = "A small bottle. Contains [D.agent] culture in synthblood medium." diff --git a/code/modules/reagents/reagent_containers/glass.dm b/code/modules/reagents/reagent_containers/glass.dm index 1908c767406..7394c728803 100644 --- a/code/modules/reagents/reagent_containers/glass.dm +++ b/code/modules/reagents/reagent_containers/glass.dm @@ -137,7 +137,7 @@ attackby(obj/item/weapon/W as obj, mob/user as mob) if(istype(W, /obj/item/weapon/pen) || istype(W, /obj/item/device/flashlight/pen)) - var/tmp_label = sanitize(input(user, "Enter a label for [src.name]","Label",src.label_text)) + var/tmp_label = sanitize(copytext(input(user, "Enter a label for [src.name]","Label",src.label_text), 1, MAX_NAME_LEN)) if(length(tmp_label) > 10) user << "\red The label can be at most 10 characters long." else diff --git a/code/unused/hivebot/emote.dm b/code/unused/hivebot/emote.dm index 12d71f6b7d2..239a8647395 100644 --- a/code/unused/hivebot/emote.dm +++ b/code/unused/hivebot/emote.dm @@ -56,10 +56,9 @@ m_type = 2 if ("custom") - var/input = input("Choose an emote to display.") as text|null + var/input = sanitize(copytext(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