????????д???????????????????????????У???????????????????DUMP??????????????recv?????????????????????????????????16??????.??????????char??????????????????????????????????????????????·????:
????1.??????????????ж???????????????????????return???????????????????5000????????趨????10000??;
????2.??char???????ж????????????????????е????????????????????????????????????????????ж???????????IsBadWritePtr???API?????????
BOOL WINAPI IsBadWritePtr??
_In_ LPVOID LP??
_In_ UINT_PTR UCB
??;
????????
????LP [??]
???????????????????????
????UCB [??]
????????????С??????????λ?????????????????????????
?????????
??????????y??????д???????????淶Χ???????????????????
??????????y????????д???????????淶Χ????????????????????????
?????????ó???????????????У??????????д????????????????淶Χ????????????ú??????μ???λ???STATUS_ACCESS_VIOLATION????????????????????????????????????????е????????????к??ù??????????????????????????????????????????????????????????????
//----------------------------------------------------------------------------
//???????????1
char *pbuf1 = new char[10];
pbuf1 = (char *)0x0;   //???????︳? pbuf?????????????????
bool br1 = IsBadWritePtr(pbuf1??10);  //????????true
if(!br1)
{
memcpy(pbuf1??"111111111"??10);
cout << pbuf1 << endl;
printf("Display1:%s "??pbuf1);
}
//???????????2
char *pbuf2 = new char[10];
bool br2 = IsBadWritePtr(pbuf2??10);  //????????true
if(!br2)
{
memcpy(pbuf2??"222222222"??10);
printf("Display2:%s "??pbuf2);
}
//??????
//Display2:222222222
//----------------------------------------------------------------------------
MFC??????????AfxIsValidAddress?????ж??
// Allocate a 5 character array?? which should have a valid memory address.
char *array = new char[5];
// Create a null pointer?? which should be an invalid memory address.
char *null = (char *)0x0;
ASSERT(AfxIsValidAddress(array?? 5));
ASSERT(!AfxIsValidAddress(null?? 5));