From 61ee4f926938b1894bedfd9f139d45db48d89903 Mon Sep 17 00:00:00 2001 From: s1lentq Date: Wed, 10 Apr 2024 12:30:59 +0700 Subject: [PATCH] Netchan_CreateFileFragments: Fixed a hang connection on verifying resource stage, when precached file exists but is absolutely empty --- rehlds/engine/net_chan.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/rehlds/engine/net_chan.cpp b/rehlds/engine/net_chan.cpp index 94149bc..5e51a8c 100644 --- a/rehlds/engine/net_chan.cpp +++ b/rehlds/engine/net_chan.cpp @@ -1203,7 +1203,9 @@ int Netchan_CreateFileFragments(qboolean server, netchan_t *chan, const char *fi if (!FS_FileExists(filename)) return FALSE; - if (FS_FileSize(filename) > sv_filetransfermaxsize.value) + + unsigned int nSize = FS_FileSize(filename); + if (nSize == 0 || nSize > sv_filetransfermaxsize.value) return FALSE; auto wait = (fragbufwaiting_t *)Mem_ZeroMalloc(sizeof(fragbufwaiting_t));