Skip to content
This repository was archived by the owner on Apr 30, 2020. It is now read-only.

Commit 57b5472

Browse files
maksqwegnanabaskaran
authored andcommitted
Fix incorrect sizes for memset() used in some places (#142)
* Fix incorrect size for memset() in the JclHeader.h * Fix incorrect size for memset in RecursiveMakeDir * Fix another incorrect size for memset() * Fix one more wrong memset() size
1 parent 8802ade commit 57b5472

4 files changed

Lines changed: 9 additions & 9 deletions

File tree

CodeXL/Components/CpuProfiling/Backend/AMDTThreadProfileAPI/src/Windows/tpCollectImpl.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ AMDTResult tpCollectImpl::tpClear()
111111
}
112112

113113
m_callstack = false;
114-
memset(m_logFilePath, 0, TP_MAX_ETL_PATH_LEN);
114+
memset(m_logFilePath, 0, TP_MAX_ETL_PATH_LEN * sizeof(wchar_t));
115115
m_sessionHandle = 0;
116116
m_tpState = AMDT_THREAD_PROFILE_STATE_UNINITIALIZED;
117117

@@ -157,7 +157,7 @@ bool tpCollectImpl::tpGetUndocAPI()
157157

158158
AMDTResult tpCollectImpl::tpInitialize()
159159
{
160-
memset(m_logFilePath, 0, TP_MAX_ETL_PATH_LEN);
160+
memset(m_logFilePath, 0, TP_MAX_ETL_PATH_LEN * sizeof(wchar_t));
161161

162162
return AMDT_STATUS_OK;
163163
}
@@ -428,4 +428,4 @@ AMDTResult tpCollectImpl::tpStopThreadProfile()
428428
}
429429

430430
return status;
431-
} // tpStopThreadProfile
431+
} // tpStopThreadProfile

CodeXL/Components/CpuProfiling/ProfilingAgents/AMDTClrProfAgent/src/ClrProfCallback.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1737,7 +1737,7 @@ int ClrProfCallBack::RecursiveMakeDir(wchar_t* dir)
17371737
wchar_t temp_dir[FILENAME_MAX];
17381738
wchar_t* next_dir = dir;
17391739

1740-
memset(temp_dir, 0, FILENAME_MAX);
1740+
memset(temp_dir, 0, FILENAME_MAX * sizeof(wchar_t));
17411741

17421742
while ((next_dir = wcschr(next_dir, L'\\')) != NULL)
17431743
{

CodeXL/Components/CpuProfiling/ProfilingAgents/AMDTProfilingAgentsData/inc/JclHeader.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ struct JclHeader
5757
hdrInfo.numRecords = 0;
5858
hdrInfo.is32Bit = 0;
5959

60-
memset(appName, 0, OS_MAX_PATH);
60+
memset(appName, 0, OS_MAX_PATH * sizeof(wchar_t));
6161
}
6262
};
6363

@@ -78,9 +78,9 @@ struct JitLoadRecord
7878

7979
JitLoadRecord()
8080
{
81-
memset(classFunctionName, 0, OS_MAX_PATH);
82-
memset(jncFileName, 0, OS_MAX_PATH);
83-
memset(srcFileName, 0, OS_MAX_PATH);
81+
memset(classFunctionName, 0, OS_MAX_PATH * sizeof(wchar_t));
82+
memset(jncFileName, 0, OS_MAX_PATH * sizeof(wchar_t));
83+
memset(srcFileName, 0, OS_MAX_PATH * sizeof(wchar_t));
8484
}
8585
};
8686

CodeXL/Components/PowerProfiling/Backend/AMDTPowerProfileAPI/src/AMDTPowerProfileDataAccess.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,7 @@ AMDTResult GetCummulativePidProfDataInstatant(AMDTUInt32* pPIDCount,
258258
else
259259
{
260260
AMDTUInt32 count = 0;
261-
memset(g_pidInfo, 0, sizeof(AMDTUInt32) * MAX_PID_CNT);
261+
memset(g_pidInfo, 0, sizeof(AMDTPwrProcessInfo) * MAX_PID_CNT);
262262

263263
for (AMDTUInt32 idx = 0; idx < entries; ++idx)
264264
{

0 commit comments

Comments
 (0)