内存溢出的问题,帮我看一下有什么问题?
mxj22 2007-04-17 10:16:24 每次运行都会出现错误,主要是在memset这里出现Stack OverFlow 看看的代码有什么问题?
else if(!strcmp(m_strButtonName,"START LOG"))
{
char *m_pstrLogLevel;
char *m_pstrModule;
char *m_pstrFunction;
char *m_pstrInformation;
char *m_pstrGetMsg;
char *m_pstrShowLog=new char[100];
if(m_pstrShowLog==NULL)
{
m_strFilterMsg="1";
UpdateData(true);
}
memset(m_pstrShowLog,0,sizeof(m_pstrShowLog));
m_pstrGetMsg=new char[pCopyDataStruct->cbData];
strcpy(m_pstrGetMsg,(char*)pCopyDataStruct->lpData);
m_pstrLogLevel=strtok(m_pstrGetMsg,",");
m_pstrModule=strtok(NULL,",");
m_pstrFunction=strtok(NULL,",");
m_pstrInformation=strtok(NULL,",");
strcat(m_pstrShowLog,m_pstrLogLevel);
strcat(m_pstrShowLog," ");
strcat(m_pstrShowLog,m_pstrModule);
strcat(m_pstrShowLog," ");
strcat(m_pstrShowLog,m_pstrFunction);
strcat(m_pstrShowLog," :");
strcat(m_pstrShowLog,m_pstrInformation);
UpdateData(true);
if(strstr(m_pstrShowLog,m_strFilterMsg)!=NULL)
{
char *m_strSystemTime=new char[26];
_strtime(m_strSystemTime);
strcat(m_strSystemTime," ");
strcat(m_strSystemTime,m_pstrShowLog);
m_LogMsg.AddString(m_strSystemTime);
pstrData=m_strSystemTime;
m_LogMsg.SetCurSel(m_LogMsg.GetCount()-1);
delete []m_strSystemTime;
}
else
{
}
delete m_pstrGetMsg;
delete m_pstrShowLog;
}