Click here to Skip to main content
15,897,704 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: How to check null or corrupted char pointer value Pin
Randor 8-Jan-09 1:34
professional Randor 8-Jan-09 1:34 
GeneralRe: How to check null or corrupted char pointer value Pin
KASR18-Jan-09 1:59
KASR18-Jan-09 1:59 
GeneralRe: How to check null or corrupted char pointer value Pin
CPallini8-Jan-09 1:34
mveCPallini8-Jan-09 1:34 
GeneralRe: How to check null or corrupted char pointer value Pin
KASR18-Jan-09 1:41
KASR18-Jan-09 1:41 
GeneralRe: How to check null or corrupted char pointer value Pin
CPallini8-Jan-09 1:50
mveCPallini8-Jan-09 1:50 
GeneralRe: How to check null or corrupted char pointer value Pin
KASR18-Jan-09 1:57
KASR18-Jan-09 1:57 
GeneralRe: How to check null or corrupted char pointer value Pin
CPallini8-Jan-09 2:06
mveCPallini8-Jan-09 2:06 
GeneralRe: How to check null or corrupted char pointer value Pin
Randor 8-Jan-09 2:19
professional Randor 8-Jan-09 2:19 
Well, technically it could be other values. For example you may recieve a ramdom garbage pointer which resolves to a loaded PE image. A better implementation for checking a variable pointer would be:

MEMORY_BASIC_INFORMATION mbi;
VirtualQueryEx(GetCurrentProcess(),pVar,&mbi,sizeof(mbi));
if (mbi.Protect == PAGE_READWRITE && mbi.State = MEM_COMMIT && mbi.Type == MEM_PRIVATE)
{
	// bad string pointer
}


This ensures:

1.) You can read and write to the address.
2.) The address is allocated and committed memory.
3.) The address is within the private region.

At this point the chance of being a good pointer has become substantially higher.

Best Wishes,
-David Delaune
QuestionINetFwMgr Pin
barneyb817-Jan-09 23:11
barneyb817-Jan-09 23:11 
AnswerRe: INetFwMgr Pin
Hamid_RT7-Jan-09 23:48
Hamid_RT7-Jan-09 23:48 
GeneralRe: INetFwMgr Pin
barneyb817-Jan-09 23:55
barneyb817-Jan-09 23:55 
Questionprotocol using vc++ Pin
hrishiS7-Jan-09 22:09
hrishiS7-Jan-09 22:09 
QuestionRe: protocol using vc++ Pin
CPallini7-Jan-09 22:39
mveCPallini7-Jan-09 22:39 
AnswerRe: protocol using vc++ Pin
hrishiS7-Jan-09 23:17
hrishiS7-Jan-09 23:17 
AnswerRe: protocol using vc++ Pin
Hamid_RT7-Jan-09 23:31
Hamid_RT7-Jan-09 23:31 
GeneralRe: protocol using vc++ Pin
toxcct8-Jan-09 1:30
toxcct8-Jan-09 1:30 
GeneralYou.... Pin
CPallini8-Jan-09 1:43
mveCPallini8-Jan-09 1:43 
GeneralRe: You.... Pin
toxcct8-Jan-09 1:54
toxcct8-Jan-09 1:54 
GeneralRe: protocol using vc++ Pin
Hamid_RT8-Jan-09 1:46
Hamid_RT8-Jan-09 1:46 
GeneralRe: protocol using vc++ Pin
toxcct8-Jan-09 1:52
toxcct8-Jan-09 1:52 
JokeRe: protocol using vc++ Pin
CPallini8-Jan-09 1:57
mveCPallini8-Jan-09 1:57 
GeneralRe: protocol using vc++ Pin
Hamid_RT8-Jan-09 2:01
Hamid_RT8-Jan-09 2:01 
RantRe: protocol using vc++ Pin
toxcct8-Jan-09 2:50
toxcct8-Jan-09 2:50 
JokeRe: protocol using vc++ Pin
CPallini8-Jan-09 3:14
mveCPallini8-Jan-09 3:14 
GeneralRe: protocol using vc++ Pin
toxcct8-Jan-09 3:25
toxcct8-Jan-09 3:25 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.