From c7089e44b0f8f223f20f9de669c2948c89fe64bb Mon Sep 17 00:00:00 2001 From: Astralcircle <142503363+Astralcircle@users.noreply.github.com> Date: Thu, 26 Nov 2026 23:55:57 +0300 Subject: [PATCH 1/2] Fix bug where it could be possible to bypass cv_max_transfer_size limit and upload file up to 64mb --- lua/entities/gmod_wire_expression2/core/files.lua | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lua/entities/gmod_wire_expression2/core/files.lua b/lua/entities/gmod_wire_expression2/core/files.lua index 9447eff05d..df1d1f60b5 100644 --- a/lua/entities/gmod_wire_expression2/core/files.lua +++ b/lua/entities/gmod_wire_expression2/core/files.lua @@ -414,13 +414,17 @@ net.Receive("wire_expression2_file_upload", function(_, ply) if pfile then if net.ReadBool() and not pfile.uploading and not pfile.uploaded then local len = net.ReadUInt(32) - if len / 1024 > cv_max_transfer_size:GetInt() then + if len > cv_max_transfer_size:GetInt() * 1024 then pfile.uploading = false pfile.uploaded = false file_execute(ply, pfile, FILE_TRANSFER_ERROR) else pfile.uploading = true pfile.Stream = net.ReadStream(ply, function(data) + if not data or #data > cv_max_transfer_size:GetInt() * 1024 then + return file_execute(ply, pfile, FILE_TRANSFER_ERROR) + end + pfile.data = data pfile.uploading = false pfile.uploaded = true @@ -489,4 +493,4 @@ E2Lib.registerEvent("fileWritten", { E2Lib.registerEvent("fileList", { { "Path", "s"}, { "Contents", "r" } -}) \ No newline at end of file +}) From 69ec1b8903f81e602e3f9e6b292839d522f97bb5 Mon Sep 17 00:00:00 2001 From: Astralcircle <142503363+Astralcircle@users.noreply.github.com> Date: Thu, 26 Nov 2026 23:57:01 +0300 Subject: [PATCH 2/2] Lint pass --- lua/entities/gmod_wire_expression2/core/files.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/entities/gmod_wire_expression2/core/files.lua b/lua/entities/gmod_wire_expression2/core/files.lua index df1d1f60b5..9b3526d7ec 100644 --- a/lua/entities/gmod_wire_expression2/core/files.lua +++ b/lua/entities/gmod_wire_expression2/core/files.lua @@ -414,7 +414,7 @@ net.Receive("wire_expression2_file_upload", function(_, ply) if pfile then if net.ReadBool() and not pfile.uploading and not pfile.uploaded then local len = net.ReadUInt(32) - if len > cv_max_transfer_size:GetInt() * 1024 then + if len > cv_max_transfer_size:GetInt() * 1024 then pfile.uploading = false pfile.uploaded = false file_execute(ply, pfile, FILE_TRANSFER_ERROR)