...
Code Block |
---|
int invalid(void* ptr) { return (ptr == NULL); } |
Some platforms will have platform-specific pointer validation tools.
...
As you can see, the invalid()
function is not perfect; it only identifies NULL
null pointers and pointers to functions as invalid.
...
This function increments the value pointed to by its argument. It also ensures that its argument is not a null pointer. But the pointer could still be invalid, thus causing the function to corrupt memory, or possibly terminate abnormally.
...
A pointer validation library can be used to identify , and thus, so prevent the execution of vulnerable code.
Failure to clear memory can result in leaked information. Occasionally, it can also lead to buffer overflows when programmers assume, for example, a NULL null-termination byte is present when it is not.
...