+ 1
What is the use of wild and dangling pointers in c??
Pointer
2 Answers
+ 1
Pointers are used to store and manage the addresses of dynamically allocated blocks of memory. Such blocks are used to store data objects or arrays of objects. Most structured and object-oriented languages provide an area of memory, called the heap or free store, from which objects are dynamically allocated.
Dangling pointer :
A pointer pointing to a memory location that has been deleted (or freed) is called dangling pointer. There are threedifferent ways where Pointer acts as dangling pointer
1) de-allocation of memory
2) function call
3) variable goes out of scope.
Wild Pointer :
A pointer which has not been initialized to anything (not even NULL) is known as wild pointer. The pointer may be initialized to a non-NULL garbage value that may not be a valid address.
https://en.m.wikipedia.org/wiki/Dangling_pointer
Thanks
+ 1
They could be used to have the address point to malicious code that executes to achieve a type of overflow.
Itâs best to clean them up if you notice them in your own code.
If someone else wrote the program and you notice it, I should say that you should probably mention it to the dev, but sometimes it can be fun to mess around and learn new things about best security practices. So, take that how you want.