Skip to content

Commit b714bfd

Browse files
committed
modify:memory buffer warn and improved
1 parent 5d81863 commit b714bfd

File tree

4 files changed

+24
-24
lines changed

4 files changed

+24
-24
lines changed

XEngine_Source/XEngine_ModuleDatabase/ModuleDatabase_ShortLink/ModuleDatabase_ShortLink.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -92,10 +92,10 @@ bool CModuleDatabase_ShortLink::ModuleDatabase_ShortLink_Insert(XENGINE_SHORTLIN
9292
DBModule_dwErrorCode = ERROR_APISERVICE_MODULE_DATABASE_PARAMENT;
9393
return false;
9494
}
95-
XCHAR tszSQLStatement[2024];
95+
XCHAR tszSQLStatement[8192];
9696
memset(tszSQLStatement, '\0', sizeof(tszSQLStatement));
9797

98-
_xstprintf(tszSQLStatement, _X("INSERT INTO `XEngine_ShortLink` (tszFullUrl,tszShortUrl,tszKeyUrl,tszMapUrl,tszCreateTime) VALUES('%s','%s','%s','%s','%s')"), pSt_SLinkInfo->tszFullUrl, pSt_SLinkInfo->tszShotUrl, pSt_SLinkInfo->tszKeyUrl, pSt_SLinkInfo->tszMapUrl, pSt_SLinkInfo->tszCreateTime);
98+
_xsntprintf(tszSQLStatement, sizeof(tszSQLStatement), _X("INSERT INTO `XEngine_ShortLink` (tszFullUrl,tszShortUrl,tszKeyUrl,tszMapUrl,tszCreateTime) VALUES('%s','%s','%s','%s','%s')"), pSt_SLinkInfo->tszFullUrl, pSt_SLinkInfo->tszShotUrl, pSt_SLinkInfo->tszKeyUrl, pSt_SLinkInfo->tszMapUrl, pSt_SLinkInfo->tszCreateTime);
9999
if (!DataBase_MySQL_Execute(xhDBSQL, tszSQLStatement))
100100
{
101101
DBModule_IsErrorOccur = true;
@@ -135,7 +135,7 @@ bool CModuleDatabase_ShortLink::ModuleDatabase_ShortLink_Query(XENGINE_SHORTLINK
135135
XCHAR tszSQLStatement[1024];
136136
memset(tszSQLStatement, '\0', sizeof(tszSQLStatement));
137137
//名称为,消息名为必填
138-
_xstprintf(tszSQLStatement, _X("SELECT * FROM `XEngine_ShortLink` WHERE tszMapUrl = '%s'"), pSt_SLinkInfo->tszMapUrl);
138+
_xsntprintf(tszSQLStatement, sizeof(tszSQLStatement), _X("SELECT * FROM `XEngine_ShortLink` WHERE tszMapUrl = '%s'"), pSt_SLinkInfo->tszMapUrl);
139139
if (!DataBase_MySQL_ExecuteQuery(xhDBSQL, &xhTable, tszSQLStatement, &nllLine, &nllRow))
140140
{
141141
DBModule_IsErrorOccur = true;

XEngine_Source/XEngine_ModuleDatabase/ModuleDatabase_XLog/ModuleDatabase_XLog.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ bool CModuleDatabase_XLog::ModuleDatabase_XLog_Insert(XENGINE_XLOGINFO* pSt_XLog
147147
XCHAR tszSQLStatement[11240];
148148
memset(tszSQLStatement, '\0', sizeof(tszSQLStatement));
149149

150-
_xstprintf(tszSQLStatement, _X("INSERT INTO `%s` (tszFileName,tszFuncName,nLogLine,nLogLevel,tszLogBuffer,tszLogTime) VALUES('%s','%s',%d,%d,'%s','%s')"), pSt_XLogInfo->tszTableName, pSt_XLogInfo->st_ProtocolLog.tszFileName, pSt_XLogInfo->st_ProtocolLog.tszFuncName, pSt_XLogInfo->st_ProtocolLog.nLogLine, pSt_XLogInfo->st_ProtocolLog.nLogLevel, pSt_XLogInfo->tszLogBuffer, pSt_XLogInfo->st_ProtocolLog.tszLogTimer);
150+
_xsntprintf(tszSQLStatement, sizeof(tszSQLStatement), _X("INSERT INTO `%s` (tszFileName,tszFuncName,nLogLine,nLogLevel,tszLogBuffer,tszLogTime) VALUES('%s','%s',%d,%d,'%s','%s')"), pSt_XLogInfo->tszTableName, pSt_XLogInfo->st_ProtocolLog.tszFileName, pSt_XLogInfo->st_ProtocolLog.tszFuncName, pSt_XLogInfo->st_ProtocolLog.nLogLine, pSt_XLogInfo->st_ProtocolLog.nLogLevel, pSt_XLogInfo->tszLogBuffer, pSt_XLogInfo->st_ProtocolLog.tszLogTimer);
151151

152152
#ifdef _MSC_BUILD
153153
XCHAR tszUTFStr[10240] = {};

XEngine_Source/XEngine_ModuleProtocol/ModuleProtocol_Packet/ModuleProtocol_Packet.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1321,9 +1321,9 @@ bool CModuleProtocol_Packet::ModuleProtocol_Packet_HardWare(XCHAR* ptszHWInfo, i
13211321
}
13221322
int nDiskNumber = 0;
13231323
XCHAR** pptszRootName;
1324-
XCHAR tszOSName[XPATH_MAX];
1325-
XCHAR tszOSVersion[XPATH_MAX];
1326-
XCHAR tszOSBuild[XPATH_MAX];
1324+
XCHAR tszOSName[256];
1325+
XCHAR tszOSVersion[256];
1326+
XCHAR tszOSBuild[256];
13271327
XLONG nOSPro = 0;
13281328
XCHAR tszOSInfo[2048];
13291329
SYSTEMAPI_DISK_INFOMATION st_DiskInfo;

XEngine_Source/XEngine_UserProtocol.h

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -126,9 +126,9 @@ typedef struct
126126
//银行卡
127127
typedef struct
128128
{
129-
XCHAR tszBankNumber[XPATH_MAX]; //银行卡号
130-
XCHAR tszBankName[XPATH_MAX]; //银行卡名称
131-
XCHAR tszBankAbridge[XPATH_MAX]; //银行卡缩写
129+
XCHAR tszBankNumber[128]; //银行卡号
130+
XCHAR tszBankName[128]; //银行卡名称
131+
XCHAR tszBankAbridge[128]; //银行卡缩写
132132
ENUM_XENGINE_APISERVICE_BANK_TYPE enBankType;
133133
}XENGINE_BANKINFO;
134134
//语言转换
@@ -166,7 +166,7 @@ typedef struct
166166
typedef struct
167167
{
168168
XENGINE_PROTOCOL_XLOG st_ProtocolLog;
169-
XCHAR tszLogBuffer[10240];
169+
XCHAR tszLogBuffer[8192];
170170
XCHAR tszTableName[128];
171171
XCHAR tszTimeStart[128];
172172
XCHAR tszTimeEnd[128];
@@ -202,7 +202,7 @@ typedef struct
202202
{
203203
MODULEHELP_SOCKETTEST_RECONNECT st_SocketConn;
204204
MODULEHELP_SOCKETTEST_DATAS st_SocketData;
205-
XCHAR tszAPIUrl[XPATH_MAX];
205+
XCHAR tszAPIUrl[256];
206206
XNETHANDLE xhToken;
207207
int nType; //0,全部报告,其他结束统计报告
208208
bool bTCP;
@@ -211,11 +211,11 @@ typedef struct
211211
//短连接
212212
typedef struct
213213
{
214-
XCHAR tszFullUrl[XPATH_MAX];
215-
XCHAR tszShotUrl[XPATH_MAX];
216-
XCHAR tszKeyUrl[XPATH_MAX];
217-
XCHAR tszMapUrl[XPATH_MAX];
218-
XCHAR tszCvtUrl[XPATH_MAX];
214+
XCHAR tszFullUrl[256];
215+
XCHAR tszShotUrl[256];
216+
XCHAR tszKeyUrl[256];
217+
XCHAR tszMapUrl[256];
218+
XCHAR tszCvtUrl[256];
219219
XCHAR tszCreateTime[64];
220220
int nLength;
221221
int nID;
@@ -224,11 +224,11 @@ typedef struct
224224
typedef struct
225225
{
226226
XCHAR tszMachineText[2048];
227-
XCHAR tszServiceName[XPATH_MAX];
228-
XCHAR tszMachineName[XPATH_MAX];
229-
XCHAR tszMachineUser[XPATH_MAX];
230-
XCHAR tszMachineCode[XPATH_MAX];
231-
XCHAR tszMachineSystem[XPATH_MAX];
227+
XCHAR tszServiceName[256];
228+
XCHAR tszMachineName[256];
229+
XCHAR tszMachineUser[256];
230+
XCHAR tszMachineCode[256];
231+
XCHAR tszMachineSystem[256];
232232
XCHAR tszLastTime[64];
233233
XCHAR tszCreateTime[64];
234234
__int64x nTimeNumber;
@@ -237,8 +237,8 @@ typedef struct
237237
//敏感词过滤器
238238
typedef struct
239239
{
240-
XCHAR tszWordsFrom[XPATH_MAX];
241-
XCHAR tszWordsTo[XPATH_MAX];
240+
XCHAR tszWordsFrom[256];
241+
XCHAR tszWordsTo[256];
242242
XBYTE nLevel; //过滤级别,0替换,1删除,2禁止
243243
}XENGINE_WORDFILTER;
244244
//图像基本属性

0 commit comments

Comments
 (0)