Ports tgstation/53371 (#60)

This commit is contained in:
SandPoot
2020-09-03 16:43:42 -03:00
committed by GitHub
parent 05485c4b2c
commit 3f6733fc72
3 changed files with 13 additions and 8 deletions
+10 -5
View File
@@ -1,7 +1,9 @@
////////////
//SECURITY//
////////////
#define UPLOAD_LIMIT 1048576 //Restricts client uploads to the server to 1MB //Could probably do with being lower.
#define UPLOAD_LIMIT 524288 //Restricts client uploads to the server to 0.5MB
#define UPLOAD_LIMIT_ADMIN 5242880 //Restricts admin client uploads to the server to 5MB
//(bumps admin's up to 5, admins should be trustworthy enough to not do shit)
GLOBAL_LIST_INIT(blacklisted_builds, list(
"1407" = "bug preventing client display overrides from working leads to clients being able to see things/mobs they shouldn't be able to see",
@@ -199,11 +201,14 @@ GLOBAL_LIST_INIT(blacklisted_builds, list(
//This stops files larger than UPLOAD_LIMIT being sent from client to server via input(), client.Import() etc.
/client/AllowUpload(filename, filelength)
if(filelength > UPLOAD_LIMIT)
if(holder)
if(filelength > UPLOAD_LIMIT_ADMIN)
to_chat(src, "<font color='red'>Error: AllowUpload(): File Upload too large. Upload Limit: [UPLOAD_LIMIT_ADMIN/1024]KiB.</font>")
return FALSE
else if(filelength > UPLOAD_LIMIT)
to_chat(src, "<font color='red'>Error: AllowUpload(): File Upload too large. Upload Limit: [UPLOAD_LIMIT/1024]KiB.</font>")
return 0
return 1
return FALSE
return TRUE
///////////
//CONNECT//
+2 -2
View File
@@ -3,12 +3,12 @@
var/datum/preferences/P = new
P.load_path("test")
P.features["flavor_text"] = "Foo"
P.features["ooc_notes"] = "Bar"
P.features["skyrat_ooc_notes"] = "Bar"
P.save_character()
P.load_character()
if(P.features["flavor_text"] != "Foo")
Fail("Flavor text is failing to save.")
if(P.features["ooc_notes"] != "Bar")
if(P.features["skyrat_ooc_notes"] != "Bar")
Fail("OOC text is failing to save.")
catch(var/exception/e)
Fail("Failed to save and load character due to exception [e.name]")