A NULL pointer dereference occurs when a program attempts to read or write memory using a NULL pointer. This error causes a segmentation fault.
Running a program that contains a NULL pointer dereference generates an immediate segmentation fault error.
The Memory Analysis tool detects the passing of a NULL pointer to string and memory functions if Verify parameters in string and memory functions is checked under Memory Errors in the configuration.
The Memory Analysis tool doesn't trap this error with the following functions: memccpy memchrv memmove memcpy memcmp memset bcopy bzero memccpy memchrv memmove memcpy memcmp memset bcopy bzero bcmp bcmp
In the code, you can explictly check for NULL returned by functions that can return NULL and then stored into pointer variables, and for all pointer values passed to the function where the problem occurred.
int main(int argc, char ** argv) { char buf[255]; char * ptr = NULL; if (argc > 1) { ptr = argv[1]; } ... strcpy(buf,ptr); return 0; }