From aaf3daa2fd760d8a678abbe0fcb137c4820fcae1 Mon Sep 17 00:00:00 2001 From: qyt <486179@qq.com> Date: Fri, 8 May 2026 09:49:13 +0000 Subject: [PATCH] Potential fix for code scanning alert no. 72 Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com> --- .../Session_Stroage/Session_UPStroage.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/XEngine_Source/StorageModule_Session/Session_Stroage/Session_UPStroage.cpp b/XEngine_Source/StorageModule_Session/Session_Stroage/Session_UPStroage.cpp index 595601a..2bcd2b6 100644 --- a/XEngine_Source/StorageModule_Session/Session_Stroage/Session_UPStroage.cpp +++ b/XEngine_Source/StorageModule_Session/Session_Stroage/Session_UPStroage.cpp @@ -190,9 +190,17 @@ bool CSession_UPStroage::Session_UPStroage_Insert(LPCXSTR lpszClientAddr, LPCXST return false; } - st_Client.st_StorageInfo.pSt_File = _xtfopen(lpszFileDir, _X("wb")); + int nFileHandle = _open(lpszFileDir, _O_CREAT | _O_WRONLY | _O_TRUNC, _S_IREAD | _S_IWRITE); + if (nFileHandle < 0) + { + Session_IsErrorOccur = true; + Session_dwErrorCode = ERROR_STORAGE_MODULE_SESSION_OPENFILE; + return false; + } + st_Client.st_StorageInfo.pSt_File = _fdopen(nFileHandle, "wb"); if (NULL == st_Client.st_StorageInfo.pSt_File) { + _close(nFileHandle); Session_IsErrorOccur = true; Session_dwErrorCode = ERROR_STORAGE_MODULE_SESSION_OPENFILE; return false;